-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create liquidbase sql for the Reservation and the Reservation entity …
…itself
- Loading branch information
1 parent
c4e7367
commit 6ad2ae1
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/main/java/com/zufar/onlinestore/reservation/dto/ReservationDto.java
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,12 @@ | ||
package com.zufar.onlinestore.reservation.dto; | ||
|
||
|
||
import java.time.LocalDateTime; | ||
|
||
public record ReservationDto( | ||
int reservationId, | ||
int productId, | ||
int reservedQuantity, | ||
LocalDateTime createdAt, | ||
String reservationStatus | ||
) {} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/zufar/onlinestore/reservation/entity/Reservation.java
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 @@ | ||
package com.zufar.onlinestore.reservation.entity; | ||
|
||
import lombok.Builder; | ||
import org.springframework.data.annotation.Id; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Builder | ||
public record Reservation( | ||
@Id | ||
int reservationId, | ||
int productId, | ||
int reservedQuantity, | ||
LocalDateTime createdAt, | ||
String reservationStatus | ||
) {} | ||
|
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 @@ | ||
--changeset Alex Zarubin:1 | ||
CREATE TABLE reservation ( | ||
reservation_id UUID NOT NULL, | ||
product_id UUID NOT NULL, | ||
reserved_quantity INT NOT NULL CHECK(reserved_amount > 0), | ||
created_at TIMESTAMP NOT NULL DEFAULT NOW(), | ||
reservation_status VARCHAR(32) NOT NULL, | ||
PRIMARY KEY (reservation_id) | ||
); | ||
CREATE UNIQUE INDEX uniq_reservation ON reservation (reservation_id, product_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