-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from aasumitro/dev
Dev
- Loading branch information
Showing
29 changed files
with
1,866 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ name: Run Linter | |
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
pull_request: | ||
branches: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS products; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CREATE TABLE IF NOT EXISTS products ( | ||
id BIGSERIAL PRIMARY KEY NOT NULL, | ||
category_id BIGINT NOT NULL, | ||
subcategory_id BIGINT NOT NULL, | ||
sku VARCHAR(255) UNIQUE NOT NULL, | ||
image VARCHAR(255), | ||
gallery TEXT, | ||
name VARCHAR(255) NOT NULL, | ||
description VARCHAR(255), | ||
price FLOAT NOT NULL | ||
); | ||
|
||
ALTER TABLE products ADD CONSTRAINT fk_products_categories | ||
FOREIGN KEY (category_id) REFERENCES categories(id); | ||
|
||
ALTER TABLE products ADD CONSTRAINT fk_products_subcategories | ||
FOREIGN KEY (subcategory_id) REFERENCES subcategories(id); |
1 change: 1 addition & 0 deletions
1
db/migrations/20221207075911_create_table_product_addons.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS addons; |
10 changes: 10 additions & 0 deletions
10
db/migrations/20221207075911_create_table_product_addons.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CREATE TABLE IF NOT EXISTS addons( | ||
id BIGSERIAL PRIMARY KEY NOT NULL, | ||
-- product_id BIGINT NOT NULL, | ||
name VARCHAR(255), | ||
description VARCHAR(255), | ||
price FLOAT | ||
); | ||
|
||
-- ALTER TABLE product_addons ADD CONSTRAINT fk_products_product_addons | ||
-- FOREIGN KEY (product_id) REFERENCES products(id); |
2 changes: 2 additions & 0 deletions
2
db/migrations/20221207075916_create_table_product_variants.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP TABLE IF EXISTS product_variants; | ||
DROP TYPE IF EXISTS variant_types; |
18 changes: 18 additions & 0 deletions
18
db/migrations/20221207075916_create_table_product_variants.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CREATE TYPE variant_types AS ENUM ('none', 'size'); | ||
|
||
CREATE TABLE IF NOT EXISTS product_variants( | ||
id BIGSERIAL PRIMARY KEY NOT NULL, | ||
product_id BIGINT NOT NULL, | ||
unit_id BIGINT NOT NULL, | ||
unit_size FLOAT, | ||
type VARIANT_TYPES DEFAULT 'none', | ||
name VARCHAR(255), | ||
description VARCHAR(255), | ||
price FLOAT | ||
); | ||
|
||
ALTER TABLE product_variants ADD CONSTRAINT fk_products_product_variants | ||
FOREIGN KEY (product_id) REFERENCES products(id); | ||
|
||
ALTER TABLE product_variants ADD CONSTRAINT fk_units_product_variants | ||
FOREIGN KEY (unit_id) REFERENCES units(id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
INSERT INTO addons (name, description, price) | ||
VALUES ('oat milk', 'replace', 1), | ||
('raw milk', 'replace', 1), | ||
('cheese', 'extra cheese', 1), | ||
('chocolate', 'extra chocolate', 1); | ||
|
||
INSERT INTO products (category_id, subcategory_id, sku, name, description, price) | ||
VALUES (2, 4, 'JMGO100', 'mango juice', 'this sweet, tangy, and fruity tropical juice can be made using a blender, handheld blender, or a food processor in under 5 minutes.', 25), | ||
(1, 2, 'WA5S100', 'wagyu a5 steak', 'The highest yield grade and meat quality grade for Wagyu beef is A5, where A represents the yield grade, and 5 represents the meat quality grade. A5 Wagyu beef denotes meat with ideal firmness and texture, coloring, yield, and beef marbling score.', 100); | ||
|
||
INSERT INTO product_variants (product_id, type, name, description, unit_id, unit_size, price) | ||
VALUES (1, 'size', 's', 'small', 4, 250, 0), | ||
(1, 'size', 'm', 'medium', 4, 480, 2), | ||
(1, 'size', 'l', 'large', 4, 650, 3), | ||
(1, 'size', 'xl', 'extra large', 5, 1.5, 1), | ||
(2, 'size', 'half', 'half portion', 1, 250, 0), | ||
(2, 'size', 'normal', 'normal portion', 1, 500, 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.