Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cart-1] Create cart and cart item database tables #54

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spring:
ddl-auto: validate
liquibase:
enabled: true
change-log: classpath:db/db.changelog-master.yaml
change-log: classpath:db/changelog-master.yaml
url: jdbc:postgresql://localhost:5432/testdb
user: postgres
password: postgres
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/db/changelog-master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
databaseChangeLog:
- include:
file: db/changelog/version-1.0/changelog-master-version-1.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE TABLE IF NOT EXISTS cart
(
id UUID PRIMARY KEY,
user_id UUID NOT NULL,
items_quantity INT NOT NULL CHECK (items_quantity >= 0),
products_quantity INT NOT NULL CHECK (products_quantity >= 0),
total_price DECIMAL NOT NULL CHECK (total_price > 0),
created_at TIMESTAMPTZ,
closed_at TIMESTAMPTZ
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS cart_item
(
id UUID PRIMARY KEY,
cart_id UUID NOT NULL,
product_id UUID NOT NULL,
products_quantity INT NOT NULL CHECK (products_quantity >= 0)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
databaseChangeLog:
- include:
file: db/changelog/version-1.0/19.07.2023.create-product-table.sql
- include:
file: db/changelog/version-1.0/20.07.2023.part1.create-cart-table.sql
- include:
file: db/changelog/version-1.0/20.07.2023.part2.create-cart-item-table.sql
3 changes: 0 additions & 3 deletions src/main/resources/db/db.changelog-master.yaml

This file was deleted.

Loading