From 2fb413587fc1d34045a8724b0aac60e8e8051560 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Sat, 16 Mar 2024 03:02:02 +0900 Subject: Add table for tagging articles. --- deploy/article_taggings.sql | 16 ++++++++++++++++ revert/article_taggings.sql | 9 +++++++++ sqitch.plan | 1 + verify/article_taggings.sql | 11 +++++++++++ 4 files changed, 37 insertions(+) create mode 100644 deploy/article_taggings.sql create mode 100644 revert/article_taggings.sql create mode 100644 verify/article_taggings.sql diff --git a/deploy/article_taggings.sql b/deploy/article_taggings.sql new file mode 100644 index 0000000..3985543 --- /dev/null +++ b/deploy/article_taggings.sql @@ -0,0 +1,16 @@ +-- Deploy diary:article_taggings to pg +-- requires: schema +-- requires: tags +-- requires: articles + +BEGIN; + +SET search_path to diary; + +CREATE TABLE article_taggings( + article_id UUID REFERENCES articles(id), + tag_id INT REFERENCES tags(id), + PRIMARY KEY(article_id, tag_id) +); + +COMMIT; diff --git a/revert/article_taggings.sql b/revert/article_taggings.sql new file mode 100644 index 0000000..6f0d57c --- /dev/null +++ b/revert/article_taggings.sql @@ -0,0 +1,9 @@ +-- Revert diary:article_taggings from pg + +BEGIN; + +SET search_path to diary; + +DROP TABLE article_taggings; + +COMMIT; diff --git a/sqitch.plan b/sqitch.plan index 71228b4..c500b49 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -5,3 +5,4 @@ schema 2024-03-10T11:00:19Z Masaya Tojo # Add schema for diary objects. articles [schema] 2024-03-10T13:54:19Z Masaya Tojo # Add table manage diary articles. tags [schema] 2024-03-10T15:55:56Z Masaya Tojo # Add table manage diary tags. +article_taggings [schema tags articles] 2024-03-15T17:54:50Z Masaya Tojo # Add table for tagging articles. diff --git a/verify/article_taggings.sql b/verify/article_taggings.sql new file mode 100644 index 0000000..9947337 --- /dev/null +++ b/verify/article_taggings.sql @@ -0,0 +1,11 @@ +-- Verify diary:article_taggings on pg + +BEGIN; + +SET search_path to diary; + +SELECT article_id, tag_id + FROM article_taggings + WHERE FALSE; + +ROLLBACK; -- cgit v1.2.3