summaryrefslogtreecommitdiff
path: root/db/migrations/0272_low_the_hood.sql
blob: 35680454515822395f4168983d1c7797be69a35a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CREATE TABLE "pr_items_for_bidding" (
	"id" serial PRIMARY KEY NOT NULL,
	"bidding_id" integer NOT NULL,
	"item_number" varchar(50),
	"project_info" varchar(300),
	"item_info" varchar(300),
	"shi" varchar(100),
	"requested_delivery_date" date,
	"annual_unit_price" numeric(15, 2),
	"currency" varchar(3) DEFAULT 'KRW',
	"quantity" numeric(10, 2),
	"quantity_unit" "quantity_unit",
	"total_weight" numeric(10, 2),
	"weight_unit" "weight_unit",
	"material_description" text,
	"pr_number" varchar(50),
	"has_spec_document" boolean DEFAULT false,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "bidding_documents" DROP CONSTRAINT "bidding_documents_pr_item_id_pr_items_id_fk";
--> statement-breakpoint
ALTER TABLE "company_pr_item_bids" DROP CONSTRAINT "company_pr_item_bids_pr_item_id_pr_items_id_fk";
--> statement-breakpoint
ALTER TABLE "pr_items_for_bidding" ADD CONSTRAINT "pr_items_for_bidding_bidding_id_biddings_id_fk" FOREIGN KEY ("bidding_id") REFERENCES "public"."biddings"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "bidding_documents" ADD CONSTRAINT "bidding_documents_pr_item_id_pr_items_for_bidding_id_fk" FOREIGN KEY ("pr_item_id") REFERENCES "public"."pr_items_for_bidding"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "company_pr_item_bids" ADD CONSTRAINT "company_pr_item_bids_pr_item_id_pr_items_for_bidding_id_fk" FOREIGN KEY ("pr_item_id") REFERENCES "public"."pr_items_for_bidding"("id") ON DELETE no action ON UPDATE no action;