Skip to content

Commit 3fe1482

Browse files
committed
fix: Enhance SQL Scripts🫸🌀✏️📗🐧🐳⬆
1 parent 55fbbb4 commit 3fe1482

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/main/resources/db/migration/V3_20241101_0722__Create_BookInstances_Table.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CREATE TABLE BookInstances (
1+
CREATE TABLE book_instances (
22
instance_id bigserial PRIMARY KEY,
3-
book_id INT REFERENCES Books(book_id),
3+
book_id BIGINT REFERENCES Books(book_id),
44
status VARCHAR(20) CHECK (status IN ('available', 'checked_out', 'reserved')) NOT NULL,
55
due_date DATE,
66
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CREATE TABLE Checkouts (
22
checkout_id bigserial PRIMARY KEY,
3-
user_id INT REFERENCES Users(user_id),
4-
instance_id INT REFERENCES BookInstances(instance_id),
3+
user_id BIGINT REFERENCES Users(user_id),
4+
instance_id BIGINT REFERENCES book_instances(instance_id),
55
checkout_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
66
return_date TIMESTAMP
77
);

src/main/resources/db/migration/V5_20241101_0725__Init_Table_Data.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ INSERT INTO Books (title, author, isbn, published_date, genre) VALUES
1010
('1984', 'George Orwell', '9780451524935', '1949-06-08', 'Dystopian');
1111

1212
-- Insert Book Instances
13-
INSERT INTO BookInstances (book_id, status, due_date) VALUES
13+
INSERT INTO book_instances (book_id, status, due_date) VALUES
1414
(1, 'available', NULL),
1515
(1, 'checked_out', '2024-07-15'),
1616
(2, 'available', NULL),

0 commit comments

Comments
 (0)