Files
growqr-backend/drizzle/0004_qscore_snapshots.sql
2026-06-01 20:58:55 +05:30

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");