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
);
