gitdataai/libs/migrate/sql/m20260508_000004_create_ai_shared_conversation.sql
ZhenYi b1ef024724 fix(migrate): reorder create_project before add_workspace_id_to_project and remove foreign keys
- Move create_project migration before add_workspace_id_to_project so the
  project table exists when workspace_id column is added
- Remove all FOREIGN KEY constraints from migration SQL files
2026-05-11 01:31:33 +08:00

13 lines
512 B
SQL

CREATE TABLE IF NOT EXISTS ai_shared_conversation (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
conversation_id UUID NOT NULL,
share_token VARCHAR(128) UNIQUE NOT NULL,
created_by UUID NOT NULL,
view_count INT NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
expires_at TIMESTAMPTZ
);
CREATE INDEX IF NOT EXISTS idx_ai_share_conv ON ai_shared_conversation (conversation_id);
CREATE INDEX IF NOT EXISTS idx_ai_share_token ON ai_shared_conversation (share_token);