diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2023-03-05 23:31:51 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2023-03-05 23:31:51 +0900 |
commit | 3f999d647e972e4f7fd807832bc4544f7aaecede (patch) | |
tree | 07b041896c4654bf9c71c0cfe839a3f647b26b4f | |
parent | c9248050393c04a0af8d359f92607c0e6888371a (diff) |
Add article_id column to transactions table.
-rw-r--r-- | deploy/transactions_article_id.sql | 11 | ||||
-rw-r--r-- | revert/transactions_article_id.sql | 8 | ||||
-rw-r--r-- | sqitch.plan | 1 | ||||
-rw-r--r-- | verify/transactions_article_id.sql | 9 |
4 files changed, 29 insertions, 0 deletions
diff --git a/deploy/transactions_article_id.sql b/deploy/transactions_article_id.sql new file mode 100644 index 0000000..fbcae41 --- /dev/null +++ b/deploy/transactions_article_id.sql @@ -0,0 +1,11 @@ +-- Deploy kakeibo:transactions_article_id to pg +-- requires: transactions +-- requires: articles + +BEGIN; + +ALTER TABLE kakeibo.transactions + ADD COLUMN article_id INTEGER, + ADD CONSTRAINT transactions_article_id_fkey FOREIGN KEY (article_id) REFERENCES kakeibo.articles (id); + +COMMIT; diff --git a/revert/transactions_article_id.sql b/revert/transactions_article_id.sql new file mode 100644 index 0000000..ed98ba5 --- /dev/null +++ b/revert/transactions_article_id.sql @@ -0,0 +1,8 @@ +-- Revert kakeibo:transactions_article_id from pg + +BEGIN; + +ALTER TABLE kakeibo.transactions + DROP COLUMN article_id; + +COMMIT; diff --git a/sqitch.plan b/sqitch.plan index b86363b..cdf5342 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -28,3 +28,4 @@ insert_transaction [insert_transaction@v1.0.0-dev3 appschema transactions] 2023- @v1.0.0-dev4 2023-03-05T05:31:39Z Masaya Tojo <masaya@tojo.tokyo> # Tag v1.0.0-dev4. articles [appschema] 2023-03-05T14:01:38Z Masaya Tojo <masaya@tojo.tokyo> # Add table for link to diary articles. +transactions_article_id [transactions articles] 2023-03-05T14:25:46Z Masaya Tojo <masaya@tojo.tokyo> # Add article_id column to transactions table. diff --git a/verify/transactions_article_id.sql b/verify/transactions_article_id.sql new file mode 100644 index 0000000..2e3d6f4 --- /dev/null +++ b/verify/transactions_article_id.sql @@ -0,0 +1,9 @@ +-- Verify kakeibo:transactions_article_id on pg + +BEGIN; + +SELECT article_id + FROM kakeibo.transactions + WHERE FALSE; + +ROLLBACK; |