Skip to content

Commit f1a0c93

Browse files
committed
feat: migration script
1 parent af3b005 commit f1a0c93

File tree

3 files changed

+1094
-0
lines changed

3 files changed

+1094
-0
lines changed

drizzle/0009_slippery_penance.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CREATE TABLE IF NOT EXISTS "easyinvoice_ecommerce_client" (
2+
"id" text PRIMARY KEY NOT NULL,
3+
"externalId" text NOT NULL,
4+
"rnClientId" text NOT NULL,
5+
"userId" text NOT NULL,
6+
"label" text NOT NULL,
7+
"domain" text NOT NULL,
8+
"feeAddress" text,
9+
"feePercentage" text,
10+
"created_at" timestamp DEFAULT now()
11+
);
12+
--> statement-breakpoint
13+
DO $$ BEGIN
14+
ALTER TABLE "easyinvoice_ecommerce_client" ADD CONSTRAINT "easyinvoice_ecommerce_client_userId_easyinvoice_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."easyinvoice_user"("id") ON DELETE cascade ON UPDATE no action;
15+
EXCEPTION
16+
WHEN duplicate_object THEN null;
17+
END $$;
18+
--> statement-breakpoint
19+
CREATE UNIQUE INDEX IF NOT EXISTS "ecommerce_client_user_id_domain_unique" ON "easyinvoice_ecommerce_client" USING btree ("userId","domain");

0 commit comments

Comments
 (0)