-
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.
- Loading branch information
1 parent
c52cd2c
commit fa7b25f
Showing
9 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
4 changes: 4 additions & 0 deletions
4
sandbox/rusty-book-manager/adapter/migrations/20241110091246_start.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,4 @@ | ||
DROP TRIGGER IF EXISTS books_updated_at_trigger ON books; | ||
DROP TABLE IF EXISTS books; | ||
|
||
DROP FUNCTION IF EXISTS set_updated_at; |
20 changes: 20 additions & 0 deletions
20
sandbox/rusty-book-manager/adapter/migrations/20241110091246_start.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,20 @@ | ||
CREATE OR REPLACE FUNCTION set_updated_at() RETURNS TRIGGER AS ' | ||
BEGIN | ||
new.updated_at := ''now''; | ||
return new; | ||
END; | ||
' LANGUAGE 'plpgsql'; | ||
|
||
CREATE TABLE IF NOT EXISTS books ( | ||
book_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), | ||
title VARCHAR(255) NOT NULL, | ||
author VARCHAR(255) NOT NULL, | ||
isbn VARCHAR(255) NOT NULL, | ||
description VARCHAR(1024) NOT NULL, | ||
created_at TIMESTAMP(3) WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP(3), | ||
updated_at TIMESTAMP(3) WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP(3) | ||
); | ||
|
||
CREATE TRIGGER books_updated_at_trigger | ||
BEFORE UPDATE ON books FOR EACH ROW | ||
EXECUTE PROCEDURE set_updated_at(); |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod model; | ||
pub mod repository; |
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 @@ | ||
pub mod event; |
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 @@ | ||
pub mod book; |