feat(04-01): add formTemplates table and extend documents schema
- 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
This commit is contained in:
12
teressa-copeland-homes/drizzle/0002_wealthy_zzzax.sql
Normal file
12
teressa-copeland-homes/drizzle/0002_wealthy_zzzax.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user