CREATE TABLE resource_share_sessions (
 session_token_hash VARCHAR(64) PRIMARY KEY,
 share_token_hash VARCHAR(64) NOT NULL,
 resource_kind VARCHAR(16) NOT NULL,
 resource_slug VARCHAR(255) NOT NULL,
 expires_at TEXT NOT NULL,
 created_at TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP),
 CONSTRAINT fk_resource_share_sessions_link FOREIGN KEY(share_token_hash) REFERENCES resource_share_links(token_hash) ON DELETE CASCADE
);
CREATE INDEX idx_resource_share_sessions_link ON resource_share_sessions(share_token_hash);
CREATE INDEX idx_resource_share_sessions_expiry ON resource_share_sessions(expires_at(32));
