diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2024-03-11 00:24:56 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2024-03-11 00:24:56 +0900 |
commit | 5039f9a506222b3f74312a4586166f5130e53817 (patch) | |
tree | 1746dbb0dfe6def169ad2b0504eba3da47d572d4 | |
parent | 516117207bbb3cca9723651b73941a2d1a5dca53 (diff) |
Add table manage diary articles.
-rw-r--r-- | deploy/articles.sql | 21 | ||||
-rw-r--r-- | revert/articles.sql | 9 | ||||
-rw-r--r-- | sqitch.plan | 1 | ||||
-rw-r--r-- | verify/articles.sql | 11 |
4 files changed, 42 insertions, 0 deletions
diff --git a/deploy/articles.sql b/deploy/articles.sql new file mode 100644 index 0000000..8c259d1 --- /dev/null +++ b/deploy/articles.sql @@ -0,0 +1,21 @@ +-- Deploy diary:articles to pg +-- requires: schema + +BEGIN; + +SET search_path to diary; + +CREATE TABLE articles( + id UUID PRIMARY KEY, + timestamp TIMESTAMPTZ NOT NULL, + hash VARCHAR(64) NOT NULL, + title TEXT NOT NULL, + body TEXT NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +COMMENT ON COLUMN articles.hash is 'SHA256 of org subtrees'; +COMMENT ON COLUMN articles.body is 'HTML of org entries'; + +COMMIT; diff --git a/revert/articles.sql b/revert/articles.sql new file mode 100644 index 0000000..d1c4310 --- /dev/null +++ b/revert/articles.sql @@ -0,0 +1,9 @@ +-- Revert diary:articles from pg + +BEGIN; + +SET search_path to diary; + +DROP TABLE articles; + +COMMIT; diff --git a/sqitch.plan b/sqitch.plan index af4c831..eea03de 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -4,3 +4,4 @@ schema 2024-03-10T11:00:19Z Masaya Tojo <masaya@tojo.tokyo> # Add schema for diary objects. update_updated_at [schema] 2024-03-10T11:29:05Z Masaya Tojo <masaya@tojo.tokyo> # Add function to update `updated_at` column. +articles [schema] 2024-03-10T13:54:19Z Masaya Tojo <masaya@tojo.tokyo> # Add table manage diary articles. diff --git a/verify/articles.sql b/verify/articles.sql new file mode 100644 index 0000000..9192a11 --- /dev/null +++ b/verify/articles.sql @@ -0,0 +1,11 @@ +-- Verify diary:articles on pg + +BEGIN; + +SET search_path to diary; + +SELECT id, timestamp, hash, title, body, created_at, updated_at + FROM articles + WHERE FALSE; + +ROLLBACK; |