aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deploy/articles.sql21
-rw-r--r--revert/articles.sql9
-rw-r--r--sqitch.plan1
-rw-r--r--verify/articles.sql11
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;