feat(03-01): add clients and documents tables to Drizzle schema
- Add pgEnum import and documentStatusEnum (Draft, Sent, Viewed, Signed) - Add clients table (id, name, email, createdAt, updatedAt) - Add documents table (id, name, clientId FK, status enum, sentAt, createdAt) - Generate migration 0001_watery_blindfold.sql and apply to local PostgreSQL
This commit is contained in:
19
teressa-copeland-homes/drizzle/0001_watery_blindfold.sql
Normal file
19
teressa-copeland-homes/drizzle/0001_watery_blindfold.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
CREATE TYPE "public"."document_status" AS ENUM('Draft', 'Sent', 'Viewed', 'Signed');--> statement-breakpoint
|
||||
CREATE TABLE "clients" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"email" text NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "documents" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"client_id" text NOT NULL,
|
||||
"status" "document_status" DEFAULT 'Draft' NOT NULL,
|
||||
"sent_at" timestamp,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "documents" ADD CONSTRAINT "documents_client_id_clients_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."clients"("id") ON DELETE cascade ON UPDATE no action;
|
||||
Reference in New Issue
Block a user