diff --git a/migrations/000.000.sql b/migrations/000.000.sql index 6dad03c..aa08d06 100644 --- a/migrations/000.000.sql +++ b/migrations/000.000.sql @@ -1 +1,22 @@ -ALTER TABLE "collections-products" RENAME TO "collections_products"; \ No newline at end of file +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 +);