Add collections and related tables
This commit is contained in:
+22
-1
@@ -1 +1,22 @@
|
||||
ALTER TABLE "collections-products" RENAME TO "collections_products";
|
||||
CREATE TABLE public.collections (
|
||||
id SERIAL NOT NULL,
|
||||
name CHARACTER VARYING(255) NOT NULL,
|
||||
inserted TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
||||
updated TIMESTAMP WITH TIME ZONE,
|
||||
designer_id INTEGER NOT NULL,
|
||||
path CHARACTER VARYING(255) NOT NULL,
|
||||
CONSTRAINT collections_pkey PRIMARY KEY (id),
|
||||
FOREIGN KEY (designer_id) REFERENCES designers (designerid)
|
||||
MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE public.collections_products (
|
||||
id SERIAL NOT NULL,
|
||||
collection_id INTEGER NOT NULL,
|
||||
product_id INTEGER,
|
||||
CONSTRAINT collections_products_pkey PRIMARY KEY (id),
|
||||
FOREIGN KEY (collection_id) REFERENCES collections (id)
|
||||
MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (product_id) REFERENCES "product-products" (productid)
|
||||
MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user