DROP INDEX "unique_external_doc";--> statement-breakpoint
DROP INDEX "unique_external_doc_project";--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "user_code" varchar(50);--> statement-breakpoint
CREATE UNIQUE INDEX "unique_external_doc" ON "documents" USING btree ("contract_id","external_document_id","discipline","external_system_type") WHERE "documents"."external_document_id" IS NOT NULL;--> statement-breakpoint
CREATE UNIQUE INDEX "unique_external_doc_project" ON "documents" USING btree ("project_id","external_document_id","discipline","external_system_type") WHERE "documents"."external_document_id" IS NOT NULL;