ALTER TABLE "tech_sales_rfqs" RENAME COLUMN "item_id" TO "item_shipbuilding_id";--> statement-breakpoint
ALTER TABLE "tech_sales_rfqs" DROP CONSTRAINT "tech_sales_rfqs_item_id_items_id_fk";
--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "drawing_kind" varchar(10);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "drawing_move_gbn" varchar(50);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "discipline" varchar(10);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "external_document_id" varchar(100);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "external_system_type" varchar(20);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "external_synced_at" timestamp;--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "c_gbn" varchar(50);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "d_gbn" varchar(50);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "degree_gbn" varchar(50);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "dept_gbn" varchar(50);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "j_gbn" varchar(50);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "s_gbn" varchar(50);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "shi_drawing_no" varchar(100);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "manager" varchar(100);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "manager_enm" varchar(100);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "manager_no" varchar(50);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "register_group" integer;--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "register_group_id" integer;--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "create_user_no" varchar(50);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "create_user_id" varchar(100);--> statement-breakpoint
ALTER TABLE "documents" ADD COLUMN "create_user_enm" varchar(100);--> statement-breakpoint
ALTER TABLE "tech_sales_rfqs" ADD CONSTRAINT "tech_sales_rfqs_item_shipbuilding_id_item_shipbuilding_id_fk" FOREIGN KEY ("item_shipbuilding_id") REFERENCES "public"."item_shipbuilding"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "unique_external_doc" ON "documents" USING btree ("contract_id","external_document_id","external_system_type") WHERE "documents"."external_document_id" IS NOT NULL;--> statement-breakpoint
CREATE INDEX "drawing_kind_idx" ON "documents" USING btree ("drawing_kind");