From 2c408648c70614a88c0412faf6d3a00d147379a2 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Sat, 7 Nov 2020 08:15:37 -0500 Subject: Added category to products. --- dichroism/migrations/2020-10-23-010929_products/up.sql | 4 +++- dichroism/migrations/2020-11-07-130734_categories/down.sql | 1 + dichroism/migrations/2020-11-07-130734_categories/up.sql | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 dichroism/migrations/2020-11-07-130734_categories/down.sql create mode 100644 dichroism/migrations/2020-11-07-130734_categories/up.sql (limited to 'dichroism/migrations') diff --git a/dichroism/migrations/2020-10-23-010929_products/up.sql b/dichroism/migrations/2020-10-23-010929_products/up.sql index 9e9c696..72a7750 100644 --- a/dichroism/migrations/2020-10-23-010929_products/up.sql +++ b/dichroism/migrations/2020-10-23-010929_products/up.sql @@ -6,6 +6,8 @@ CREATE TABLE "products" ( "name" TEXT NOT NULL, "description" TEXT NOT NULL, "featured" INTEGER NOT NULL, + "category" INTEGER NOT NULL, PRIMARY KEY("id"), - FOREIGN KEY("photo_set") REFERENCES "photo_sets"("id") + FOREIGN KEY("photo_set") REFERENCES "photo_sets"("id"), + FOREIGN KEY("category") REFERENCES "categories"("id") ) diff --git a/dichroism/migrations/2020-11-07-130734_categories/down.sql b/dichroism/migrations/2020-11-07-130734_categories/down.sql new file mode 100644 index 0000000..68ea5a7 --- /dev/null +++ b/dichroism/migrations/2020-11-07-130734_categories/down.sql @@ -0,0 +1 @@ +DROP TABLE "categories" diff --git a/dichroism/migrations/2020-11-07-130734_categories/up.sql b/dichroism/migrations/2020-11-07-130734_categories/up.sql new file mode 100644 index 0000000..1bdd50d --- /dev/null +++ b/dichroism/migrations/2020-11-07-130734_categories/up.sql @@ -0,0 +1,5 @@ +CREATE TABLE "categories" ( + "id" INTEGER NOT NULL, + "path" TEXT NOT NULL UNIQUE, + PRIMARY KEY("id") +) -- cgit v1.2.3