Skip to content

Commit 98f01a8

Browse files
committed
chore(db): regenerate file version migration after staging's 0364
1 parent 35ac722 commit 98f01a8

3 files changed

Lines changed: 28029 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
CREATE TYPE "public"."workspace_file_version_source" AS ENUM('upload', 'user', 'api', 'copilot', 'workflow', 'collab', 'revert', 'unknown');--> statement-breakpoint
2+
CREATE TABLE "workspace_file_version" (
3+
"id" text PRIMARY KEY NOT NULL,
4+
"file_id" text NOT NULL,
5+
"workspace_id" text NOT NULL,
6+
"version" integer NOT NULL,
7+
"key" text NOT NULL,
8+
"size_bytes" bigint NOT NULL,
9+
"content_type" text NOT NULL,
10+
"content_hash" text,
11+
"content_updated_at" timestamp NOT NULL,
12+
"superseded_at" timestamp,
13+
"source" "workspace_file_version_source" NOT NULL,
14+
"author_user_ids" text[] DEFAULT '{}'::text[] NOT NULL,
15+
"restored_from_version" integer,
16+
"secret_provenance_status" text,
17+
"secret_provenance_entries" jsonb DEFAULT '[]'::jsonb NOT NULL,
18+
"created_at" timestamp DEFAULT now() NOT NULL,
19+
"updated_at" timestamp DEFAULT now() NOT NULL,
20+
CONSTRAINT "workspace_file_version_provenance_status_check" CHECK ("workspace_file_version"."secret_provenance_status" IS NULL OR "workspace_file_version"."secret_provenance_status" IN ('exact', 'unknown', 'unrecorded'))
21+
);
22+
--> statement-breakpoint
23+
ALTER TABLE "workspace_file_version" ADD CONSTRAINT "workspace_file_version_file_id_workspace_files_id_fk" FOREIGN KEY ("file_id") REFERENCES "public"."workspace_files"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
24+
ALTER TABLE "workspace_file_version" ADD CONSTRAINT "workspace_file_version_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
25+
CREATE UNIQUE INDEX "workspace_file_version_file_version_unique" ON "workspace_file_version" USING btree ("file_id","version");--> statement-breakpoint
26+
CREATE UNIQUE INDEX "workspace_file_version_key_unique" ON "workspace_file_version" USING btree ("key");--> statement-breakpoint
27+
CREATE INDEX "workspace_file_version_workspace_id_idx" ON "workspace_file_version" USING btree ("workspace_id","id");--> statement-breakpoint
28+
CREATE INDEX "workspace_file_version_workspace_superseded_idx" ON "workspace_file_version" USING btree ("workspace_id","superseded_at") WHERE "workspace_file_version"."superseded_at" IS NOT NULL;

0 commit comments

Comments
 (0)