File size: 969 Bytes
ceb943f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CREATE TYPE "public"."availability_status" AS ENUM('IN_STOCK', 'SOLD_OUT', 'DISCONTINUED');--> statement-breakpoint
CREATE TYPE "public"."marketplace_type" AS ENUM('amazon', 'ebay', 'etsy');--> statement-breakpoint
CREATE TABLE "marketplace_matches" (
	"id" text PRIMARY KEY NOT NULL,
	"object_id" text NOT NULL,
	"marketplace" "marketplace_type" NOT NULL,
	"product_id" text NOT NULL,
	"product_name" text NOT NULL,
	"price" real NOT NULL,
	"availability_status" "availability_status" NOT NULL,
	"affiliate_url" text NOT NULL,
	"matched_at" timestamp (3) with time zone DEFAULT now() NOT NULL,
	"created_at" timestamp (3) with time zone DEFAULT now() NOT NULL,
	"updated_at" timestamp (3) with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "marketplace_matches" ADD CONSTRAINT "marketplace_matches_object_id_detected_objects_id_fk" FOREIGN KEY ("object_id") REFERENCES "public"."detected_objects"("id") ON DELETE cascade ON UPDATE no action;