aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2024-03-16 03:07:05 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2024-03-16 03:07:05 +0900
commit6fcbad753b6b513f74fa15c252d752f30491e519 (patch)
treeeb07310403b2a9dd948d0645de33af372cdd0bea
parent2fb413587fc1d34045a8724b0aac60e8e8051560 (diff)
Add table to link articles.
-rw-r--r--deploy/article_links.sql16
-rw-r--r--revert/article_links.sql9
-rw-r--r--sqitch.plan1
-rw-r--r--verify/article_links.sql11
4 files changed, 37 insertions, 0 deletions
diff --git a/deploy/article_links.sql b/deploy/article_links.sql
new file mode 100644
index 0000000..622076e
--- /dev/null
+++ b/deploy/article_links.sql
@@ -0,0 +1,16 @@
+-- Deploy diary:article_links to pg
+-- requires: schema
+-- requires: articles
+
+BEGIN;
+
+SET search_path to diary;
+
+CREATE TABLE article_links(
+ article_id UUID REFERENCES articles(id),
+ linked_article_id UUID REFERENCES articles(id),
+ PRIMARY KEY(article_id, linked_article_id)
+);
+
+
+COMMIT;
diff --git a/revert/article_links.sql b/revert/article_links.sql
new file mode 100644
index 0000000..d642a09
--- /dev/null
+++ b/revert/article_links.sql
@@ -0,0 +1,9 @@
+-- Revert diary:article_links from pg
+
+BEGIN;
+
+SET search_path to diary;
+
+DROP TABLE article_links;
+
+COMMIT;
diff --git a/sqitch.plan b/sqitch.plan
index c500b49..ae245e1 100644
--- a/sqitch.plan
+++ b/sqitch.plan
@@ -6,3 +6,4 @@ schema 2024-03-10T11:00:19Z Masaya Tojo <masaya@tojo.tokyo> # Add schema for dia
articles [schema] 2024-03-10T13:54:19Z Masaya Tojo <masaya@tojo.tokyo> # Add table manage diary articles.
tags [schema] 2024-03-10T15:55:56Z Masaya Tojo <masaya@tojo.tokyo> # Add table manage diary tags.
article_taggings [schema tags articles] 2024-03-15T17:54:50Z Masaya Tojo <masaya@tojo.tokyo> # Add table for tagging articles.
+article_links [schema articles] 2024-03-15T18:04:03Z Masaya Tojo <masaya@tojo.tokyo> # Add table to link articles.
diff --git a/verify/article_links.sql b/verify/article_links.sql
new file mode 100644
index 0000000..f3fe4a0
--- /dev/null
+++ b/verify/article_links.sql
@@ -0,0 +1,11 @@
+-- Verify diary:article_links on pg
+
+BEGIN;
+
+SET search_path to diary;
+
+SELECT article_id, linked_article_id
+ FROM article_links
+ WHERE FALSE;
+
+ROLLBACK;