diff options
-rw-r--r-- | deploy/diaries.sql | 18 | ||||
-rw-r--r-- | revert/diaries.sql | 9 | ||||
-rw-r--r-- | sqitch.plan | 1 | ||||
-rw-r--r-- | verify/diaries.sql | 11 |
4 files changed, 39 insertions, 0 deletions
diff --git a/deploy/diaries.sql b/deploy/diaries.sql new file mode 100644 index 0000000..3188490 --- /dev/null +++ b/deploy/diaries.sql @@ -0,0 +1,18 @@ +-- Deploy photos:diaries to pg +-- requires: schema +-- requires: photos + +BEGIN; + +SET search_path to photos; + +CREATE TABLE diaries ( + id UUID PRIMARY KEY, + photo_id UUID NOT NULL REFERENCES photos(id) ON DELETE RESTRICT ON UPDATE RESTRICT, + title TEXT NOT NULL, + entry TEXT NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +COMMIT; diff --git a/revert/diaries.sql b/revert/diaries.sql new file mode 100644 index 0000000..6b5ea7c --- /dev/null +++ b/revert/diaries.sql @@ -0,0 +1,9 @@ +-- Revert photos:diaries from pg + +BEGIN; + +SET search_path to photos; + +DROP TABLE diaries; + +COMMIT; diff --git a/sqitch.plan b/sqitch.plan index eb3f8f2..3e3ee77 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -6,3 +6,4 @@ schema 2023-08-27T13:52:33Z Masaya Tojo <masaya@tojo.tokyo> # Add schema for all photos [schema] 2023-08-29T13:12:25Z Masaya Tojo <masaya@tojo.tokyo> # Create table to manage my photos. update_timestamp [schema] 2023-08-29T15:03:35Z Masaya Tojo <masaya@tojo.tokyo> # Add function to update timestamp photos_update_timestamp [schema photos update_timestamp] 2023-08-29T15:15:40Z Masaya Tojo <masaya@tojo.tokyo> # Add update_timestamp trigger to photos table +diaries [schema photos] 2023-08-29T15:30:42Z Masaya Tojo <masaya@tojo.tokyo> # Add table to manage diaries diff --git a/verify/diaries.sql b/verify/diaries.sql new file mode 100644 index 0000000..654c2ff --- /dev/null +++ b/verify/diaries.sql @@ -0,0 +1,11 @@ +-- Verify photos:diaries on pg + +BEGIN; + +SET search_path to photos; + +SELECT id, photo_id, title, entry, created_at, updated_at + FROM diaries + WHERE FALSE; + +ROLLBACK; |