summaryrefslogtreecommitdiff
path: root/db/migrations/0244_nebulous_mandarin.sql
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-08-04 09:36:14 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-08-04 09:36:14 +0000
commit92eda21e45d902663052575aaa4c4f80bfa2faea (patch)
tree8483702edf82932d4359a597a854fa8e1b48e94b /db/migrations/0244_nebulous_mandarin.sql
parentf0213de0d2fb5fcb931b3ddaddcbb6581cab5d28 (diff)
(대표님) 벤더 문서 변경사항, data-table 변경, sync 변경
Diffstat (limited to 'db/migrations/0244_nebulous_mandarin.sql')
-rw-r--r--db/migrations/0244_nebulous_mandarin.sql5
1 files changed, 5 insertions, 0 deletions
diff --git a/db/migrations/0244_nebulous_mandarin.sql b/db/migrations/0244_nebulous_mandarin.sql
new file mode 100644
index 00000000..cbe71273
--- /dev/null
+++ b/db/migrations/0244_nebulous_mandarin.sql
@@ -0,0 +1,5 @@
+ALTER TABLE "documents" ADD COLUMN "project_id" integer NOT NULL;--> statement-breakpoint
+ALTER TABLE "documents" ADD CONSTRAINT "documents_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+CREATE UNIQUE INDEX "unique_project_doc_status" ON "documents" USING btree ("project_id","doc_number","status");--> statement-breakpoint
+CREATE UNIQUE INDEX "unique_project_vendor_doc" ON "documents" USING btree ("project_id","vendor_doc_number") WHERE "documents"."vendor_doc_number" IS NOT NULL;--> statement-breakpoint
+CREATE UNIQUE INDEX "unique_external_doc_project" ON "documents" USING btree ("project_id","external_document_id","external_system_type") WHERE "documents"."external_document_id" IS NOT NULL; \ No newline at end of file