UPDATE resource_share_links SET token = NULL;
CREATE TABLE resource_share_sessions (
 session_token_hash TEXT PRIMARY KEY,
 share_token_hash TEXT NOT NULL REFERENCES resource_share_links(token_hash) ON DELETE CASCADE,
 resource_kind TEXT NOT NULL,
 resource_slug TEXT NOT NULL,
 expires_at TEXT NOT NULL,
 created_at TEXT NOT NULL DEFAULT (CURRENT_TIMESTAMP::text)
);
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);
