diff options
-rw-r--r-- | deploy/photos.sql | 19 | ||||
-rw-r--r-- | revert/photos.sql | 9 | ||||
-rw-r--r-- | sqitch.plan | 1 | ||||
-rw-r--r-- | verify/photos.sql | 11 |
4 files changed, 40 insertions, 0 deletions
diff --git a/deploy/photos.sql b/deploy/photos.sql new file mode 100644 index 0000000..7b727b5 --- /dev/null +++ b/deploy/photos.sql @@ -0,0 +1,19 @@ +-- Deploy photos:photos to pg +-- requires: schema + +BEGIN; + +SET client_min_messages = 'warning'; +SET search_path to photos; + +CREATE TABLE photos( + id UUID PRIMARY KEY, + path TEXT NOT NULL, + is_receipt BOOLEAN NOT NULL DEFAULT FALSE, + taken_at TIME, + camera_name TEXT, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +COMMIT; diff --git a/revert/photos.sql b/revert/photos.sql new file mode 100644 index 0000000..7fb3606 --- /dev/null +++ b/revert/photos.sql @@ -0,0 +1,9 @@ +-- Revert photos:photos from pg + +BEGIN; + +SET search_path to photos; + +DROP TABLE photos; + +COMMIT; diff --git a/sqitch.plan b/sqitch.plan index ec96975..d0820d2 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -3,3 +3,4 @@ %uri=http://git.private.tojo.tokyo/ schema 2023-08-27T13:52:33Z Masaya Tojo,,, <masaya@laptop> # Add schema for all photos objects. +photos [schema] 2023-08-29T13:12:25Z Masaya Tojo,,, <masaya@laptop> # Create table to manage my photos. diff --git a/verify/photos.sql b/verify/photos.sql new file mode 100644 index 0000000..b082730 --- /dev/null +++ b/verify/photos.sql @@ -0,0 +1,11 @@ +-- Verify photos:photos on pg + +BEGIN; + +SET search_path to photos; + +SELECT id, path, is_receipt, taken_at, camera_name, created_at, updated_at + FROM photos + WHERE FALSE; + +ROLLBACK; |