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:
Chandler Copeland
2026-03-19 16:17:26 -06:00
parent 3cda82df51
commit f8f8b8f4ba
4 changed files with 240 additions and 1 deletions

View 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;