summaryrefslogtreecommitdiff
path: root/db/migrations_backup/0014_clammy_power_man.sql
blob: 3fd6a1e359ae13f7b1ade6bcdb747c5f15b0227f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
CREATE TABLE "items" (
	"id" serial PRIMARY KEY NOT NULL,
	"item_code" varchar(100) PRIMARY KEY NOT NULL,
	"item_name" varchar(255) NOT NULL,
	"description" text,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "vendor_possible_items" ALTER COLUMN "item_code" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "rfq_items" ADD CONSTRAINT "rfq_items_item_code_items_item_code_fk" FOREIGN KEY ("item_code") REFERENCES "public"."items"("item_code") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "vendor_possible_items" ADD CONSTRAINT "vendor_possible_items_item_code_items_item_code_fk" FOREIGN KEY ("item_code") REFERENCES "public"."items"("item_code") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "rfq_items" DROP COLUMN "item_name";--> statement-breakpoint
ALTER TABLE "vendor_possible_items" DROP COLUMN "item_name";