Add revised version of collections

This commit is contained in:
Rikard Bartholf
2016-02-15 10:31:50 +01:00
parent 117caefdaa
commit 9dfb91a356
+22 -17
View File
@@ -1,22 +1,27 @@
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,
CREATE TABLE 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
CONSTRAINT collections_designer_id_fkey 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,
CREATE TABLE 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
CONSTRAINT collections_products_collection_id_fkey FOREIGN KEY (collection_id)
REFERENCES collections (id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT collections_products_product_id_fkey FOREIGN KEY (product_id)
REFERENCES "product-products" (productid) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
);