summaryrefslogtreecommitdiff
path: root/db/migrations/0007_big_franklin_storm.sql
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations/0007_big_franklin_storm.sql')
-rw-r--r--db/migrations/0007_big_franklin_storm.sql37
1 files changed, 37 insertions, 0 deletions
diff --git a/db/migrations/0007_big_franklin_storm.sql b/db/migrations/0007_big_franklin_storm.sql
new file mode 100644
index 00000000..33e34a8a
--- /dev/null
+++ b/db/migrations/0007_big_franklin_storm.sql
@@ -0,0 +1,37 @@
+CREATE TABLE "vendor_contacts" (
+ "id" serial PRIMARY KEY NOT NULL,
+ "vendor_id" integer NOT NULL,
+ "contact_name" varchar(255) NOT NULL,
+ "contact_position" varchar(100),
+ "contact_email" varchar(255) NOT NULL,
+ "contact_phone" varchar(50),
+ "is_primary" boolean DEFAULT false NOT NULL,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "updated_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE "vendor_possible_items" (
+ "id" serial PRIMARY KEY NOT NULL,
+ "vendor_id" integer NOT NULL,
+ "item_name" varchar(255),
+ "description" text,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "updated_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE "vendors" (
+ "id" serial PRIMARY KEY NOT NULL,
+ "vendor_name" varchar(255) NOT NULL,
+ "vendor_code" varchar(100),
+ "address" text,
+ "country" varchar(100),
+ "phone" varchar(50),
+ "email" varchar(255),
+ "website" varchar(255),
+ "status" varchar(50) DEFAULT 'ACTIVE' NOT NULL,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "updated_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+ALTER TABLE "vendor_contacts" ADD CONSTRAINT "vendor_contacts_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE "vendor_possible_items" ADD CONSTRAINT "vendor_possible_items_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action; \ No newline at end of file