16 lines
726 B
SQL
16 lines
726 B
SQL
CREATE TABLE IF NOT EXISTS "TVstarSession" (
|
|
"id" uuid PRIMARY KEY NOT NULL,
|
|
"projectId" uuid NOT NULL REFERENCES "CanvasProject"("id") ON DELETE CASCADE,
|
|
"userId" uuid NOT NULL REFERENCES "User"("id") ON DELETE CASCADE,
|
|
"title" varchar(256) NOT NULL,
|
|
"snapshot" jsonb NOT NULL,
|
|
"clientUpdatedAt" timestamp NOT NULL,
|
|
"shareToken" varchar(64) UNIQUE,
|
|
"sharedSnapshot" jsonb,
|
|
"sharedAt" timestamp,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
CREATE INDEX IF NOT EXISTS "TVstarSession_project_updated_idx" ON "TVstarSession" ("projectId", "updatedAt");
|
|
CREATE INDEX IF NOT EXISTS "TVstarSession_user_project_idx" ON "TVstarSession" ("userId", "projectId");
|