mirror of
https://gitea.gofwd.group/sean/gunbuilder-next-tailwind.git
synced 2025-12-06 02:56:45 -05:00
shit show but data works
This commit is contained in:
77
drizzle/migrations/0000_luxuriant_albert_cleary.sql
Normal file
77
drizzle/migrations/0000_luxuriant_albert_cleary.sql
Normal file
@@ -0,0 +1,77 @@
|
||||
-- Current sql file was generated after introspecting the database
|
||||
-- If you want to run this migration please uncomment this code before executing migrations
|
||||
/*
|
||||
CREATE TABLE "product_category_mappings" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"feed_name" varchar(255),
|
||||
"feed_category_value" varchar(255),
|
||||
"canonical_category_id" integer,
|
||||
"confidence_score" double precision,
|
||||
"last_reviewed_by" varchar(255),
|
||||
"last_reviewed_at" timestamp
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "categories" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"name" varchar(255) NOT NULL,
|
||||
"parent_id" integer,
|
||||
"slug" varchar(255) NOT NULL,
|
||||
CONSTRAINT "categories_slug_key" UNIQUE("slug")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "products" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"name" varchar(255) NOT NULL,
|
||||
"brand" varchar(255),
|
||||
"description" text,
|
||||
"upc" varchar(32),
|
||||
"mpn" varchar(64),
|
||||
"canonical_category_id" integer,
|
||||
"created_at" timestamp DEFAULT now(),
|
||||
"updated_at" timestamp DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "offers" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"product_id" integer,
|
||||
"feed_name" varchar(255) NOT NULL,
|
||||
"feed_sku" varchar(255),
|
||||
"price" numeric(10, 2),
|
||||
"url" text,
|
||||
"in_stock" boolean,
|
||||
"vendor" varchar(255),
|
||||
"last_seen_at" timestamp DEFAULT now(),
|
||||
"raw_data" jsonb,
|
||||
CONSTRAINT "offers_product_id_feed_name_feed_sku_key" UNIQUE("product_id","feed_name","feed_sku"),
|
||||
CONSTRAINT "offers_feed_unique" UNIQUE("feed_name","feed_sku")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "offer_price_history" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"offer_id" integer,
|
||||
"price" numeric(10, 2) NOT NULL,
|
||||
"seen_at" timestamp DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "feeds" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"name" varchar(255) NOT NULL,
|
||||
"url" text,
|
||||
"last_imported_at" timestamp,
|
||||
CONSTRAINT "feeds_name_key" UNIQUE("name")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "product_attributes" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"product_id" integer,
|
||||
"name" varchar(255) NOT NULL,
|
||||
"value" varchar(255) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "product_category_mappings" ADD CONSTRAINT "product_category_mappings_canonical_category_id_fkey" FOREIGN KEY ("canonical_category_id") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "categories" ADD CONSTRAINT "categories_parent_id_fkey" FOREIGN KEY ("parent_id") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "products" ADD CONSTRAINT "products_canonical_category_id_fkey" FOREIGN KEY ("canonical_category_id") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "offers" ADD CONSTRAINT "offers_product_id_fkey" FOREIGN KEY ("product_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "offer_price_history" ADD CONSTRAINT "offer_price_history_offer_id_fkey" FOREIGN KEY ("offer_id") REFERENCES "public"."offers"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "product_attributes" ADD CONSTRAINT "product_attributes_product_id_fkey" FOREIGN KEY ("product_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action;
|
||||
*/
|
||||
Reference in New Issue
Block a user