- Add formTemplates table (id text PK, name, filename unique, createdAt, updatedAt) - Add formTemplateId (nullable FK) and filePath (nullable text) to documents table - Generate and apply migration 0002_wealthy_zzzax.sql - Create seeds/forms/.gitkeep to track seed directory in git
12 lines
669 B
SQL
12 lines
669 B
SQL
CREATE TABLE "form_templates" (
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
"name" text NOT NULL,
|
|
"filename" text NOT NULL,
|
|
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
CONSTRAINT "form_templates_filename_unique" UNIQUE("filename")
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "documents" ADD COLUMN "form_template_id" text;--> statement-breakpoint
|
|
ALTER TABLE "documents" ADD COLUMN "file_path" text;--> statement-breakpoint
|
|
ALTER TABLE "documents" ADD CONSTRAINT "documents_form_template_id_form_templates_id_fk" FOREIGN KEY ("form_template_id") REFERENCES "public"."form_templates"("id") ON DELETE no action ON UPDATE no action; |