diff options
Diffstat (limited to 'db/migrations/0244_nebulous_mandarin.sql')
| -rw-r--r-- | db/migrations/0244_nebulous_mandarin.sql | 5 |
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 |
