ALTER TABLE prompts ADD COLUMN gitea_user_id bigint CHECK (gitea_user_id > 0); CREATE INDEX prompts_repository_user_created_at_idx ON prompts (repository_id, gitea_user_id, created_at DESC) WHERE gitea_user_id IS NOT NULL;