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