From 81e75a48881478455ad6e70010324f7120f605dc Mon Sep 17 00:00:00 2001 From: eraden Date: Sat, 30 Apr 2022 07:09:40 +0200 Subject: [PATCH] Add photos --- ...04300700_additional_items_and_discounts.sql | 18 ++++++++++++++++++ db/migrate/202204300704_photos.sql | 11 +++++++++++ 2 files changed, 29 insertions(+) create mode 100644 db/drafts/202204300700_additional_items_and_discounts.sql create mode 100644 db/migrate/202204300704_photos.sql diff --git a/db/drafts/202204300700_additional_items_and_discounts.sql b/db/drafts/202204300700_additional_items_and_discounts.sql new file mode 100644 index 0000000..5c10c9b --- /dev/null +++ b/db/drafts/202204300700_additional_items_and_discounts.sql @@ -0,0 +1,18 @@ +CREATE TABLE coupons ( + id serial not null primary key, + "name" varchar not null, + "code" varchar not null, + "value" int not null default 0 +); + +create table additional_products ( + id serial not null primary key, + parent_product_id int references products (id) not null, + free_product_id int references products (id) not null +); + +create table addtional_items ( + id serial not null primary key, + parent_product_id int references products (id) not null, + "name" varchar not null +); diff --git a/db/migrate/202204300704_photos.sql b/db/migrate/202204300704_photos.sql new file mode 100644 index 0000000..473a721 --- /dev/null +++ b/db/migrate/202204300704_photos.sql @@ -0,0 +1,11 @@ +CREATE TABLE photos ( + id serial not null primary key, + "local_path" varchar not null unique, + "hashed_path" varchar not null unique +); + +create table product_photos ( + id serial not null primary key, + product_id int references products (id) not null, + photo_id int references photos (id) not null +);