From 8fdc5179b1d5ba075c74f28337f1c83e28240ed2 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Mon, 11 Mar 2024 01:04:48 +0900 Subject: Add table manage diary article tags. --- deploy/article_tags.sql | 15 +++++++++++++++ revert/article_tags.sql | 9 +++++++++ sqitch.plan | 1 + verify/article_tags.sql | 11 +++++++++++ 4 files changed, 36 insertions(+) create mode 100644 deploy/article_tags.sql create mode 100644 revert/article_tags.sql create mode 100644 verify/article_tags.sql diff --git a/deploy/article_tags.sql b/deploy/article_tags.sql new file mode 100644 index 0000000..617dcdc --- /dev/null +++ b/deploy/article_tags.sql @@ -0,0 +1,15 @@ +-- Deploy diary:article_tags to pg +-- requires: schema + +BEGIN; + +SET search_path to diary; + +CREATE TABLE article_tags( + id UUID PRIMARY KEY, + name TEXT UNIQUE NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +COMMIT; diff --git a/revert/article_tags.sql b/revert/article_tags.sql new file mode 100644 index 0000000..57478d0 --- /dev/null +++ b/revert/article_tags.sql @@ -0,0 +1,9 @@ +-- Revert diary:article_tags from pg + +BEGIN; + +SET search_path to diary; + +DROP TABLE article_tags; + +COMMIT; diff --git a/sqitch.plan b/sqitch.plan index 47af4b2..c4be025 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -6,3 +6,4 @@ schema 2024-03-10T11:00:19Z Masaya Tojo # Add schema for dia update_updated_at [schema] 2024-03-10T11:29:05Z Masaya Tojo # Add function to update `updated_at` column. articles [schema] 2024-03-10T13:54:19Z Masaya Tojo # Add table manage diary articles. articles_update_updated_at [schema articles update_updated_at] 2024-03-10T15:28:20Z Masaya Tojo # Add update_updated_at trigger to articles table. +article_tags [schema] 2024-03-10T15:55:56Z Masaya Tojo # Add table manage diary article tags. diff --git a/verify/article_tags.sql b/verify/article_tags.sql new file mode 100644 index 0000000..46119c3 --- /dev/null +++ b/verify/article_tags.sql @@ -0,0 +1,11 @@ +-- Verify diary:article_tags on pg + +BEGIN; + +SET search_path to diary; + +SELECT id, name, created_at, updated_at + FROM article_tags + WHERE FALSE; + +ROLLBACK; -- cgit v1.2.3