12 lines
581 B
SQL
12 lines
581 B
SQL
CREATE TABLE IF NOT EXISTS "qscore_snapshots" (
|
|
"id" text PRIMARY KEY DEFAULT gen_random_uuid()::text NOT NULL,
|
|
"user_id" text NOT NULL REFERENCES "users"("id") ON DELETE cascade,
|
|
"run_id" text REFERENCES "workflow_runs"("id") ON DELETE cascade,
|
|
"snapshot_type" text NOT NULL,
|
|
"score" integer,
|
|
"payload" jsonb,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
CREATE INDEX IF NOT EXISTS "qscore_snapshots_user_idx" ON "qscore_snapshots" ("user_id", "created_at");
|
|
CREATE INDEX IF NOT EXISTS "qscore_snapshots_run_idx" ON "qscore_snapshots" ("run_id");
|