29 lines
1.2 KiB
SQL
29 lines
1.2 KiB
SQL
CREATE TABLE "wishlist_categories" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"name" text NOT NULL,
|
|
"slug" text NOT NULL,
|
|
"min_price" integer DEFAULT 0 NOT NULL,
|
|
"max_price" integer,
|
|
"color" text,
|
|
"icon" text,
|
|
"order" integer DEFAULT 0 NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
CONSTRAINT "wishlist_categories_name_unique" UNIQUE("name"),
|
|
CONSTRAINT "wishlist_categories_slug_unique" UNIQUE("slug")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "wishlist_items" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"title" text NOT NULL,
|
|
"description" text,
|
|
"price" integer NOT NULL,
|
|
"currency" text DEFAULT 'RUB' NOT NULL,
|
|
"link" text,
|
|
"images" text[] DEFAULT ARRAY[]::text[] NOT NULL,
|
|
"category_id" uuid NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "wishlist_items" ADD CONSTRAINT "wishlist_items_category_id_wishlist_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."wishlist_categories"("id") ON DELETE restrict ON UPDATE no action; |