From 4b552c58f5988d1af18ef34ccec5979081c3bc14 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Sun, 5 Mar 2023 12:49:00 +0900 Subject: Add types table for manage type column of transactions. --- deploy/types.sql | 12 ++++++++++++ revert/types.sql | 7 +++++++ sqitch.plan | 3 +++ verify/types.sql | 10 ++++++++++ 4 files changed, 32 insertions(+) create mode 100644 deploy/types.sql create mode 100644 revert/types.sql create mode 100644 verify/types.sql diff --git a/deploy/types.sql b/deploy/types.sql new file mode 100644 index 0000000..7d13dd8 --- /dev/null +++ b/deploy/types.sql @@ -0,0 +1,12 @@ +-- Deploy kakeibo:types to pg +-- requires: appschema + +BEGIN; + +CREATE TABLE kakeibo.types ( + code INTEGER PRIMARY KEY, + name TEXT NOT NULL +); +INSERT INTO kakeibo.types VALUES (0, '支出'), (1, '収入'); + +COMMIT; diff --git a/revert/types.sql b/revert/types.sql new file mode 100644 index 0000000..ecb5329 --- /dev/null +++ b/revert/types.sql @@ -0,0 +1,7 @@ +-- Revert kakeibo:types from pg + +BEGIN; + +DROP TABLE kakeibo.types; + +COMMIT; diff --git a/sqitch.plan b/sqitch.plan index 603c46e..5bb51d2 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -14,7 +14,10 @@ update_timestamp [appschema] 2023-02-28T14:30:04Z Masaya Tojo # Add update_timestamp trigger to transactions table. items_update_timestamp [items update_timestamp] 2023-02-28T17:04:02Z Masaya Tojo # Add update_timestamp trigger to items table. @v1.0.0-dev1 2023-03-04T09:29:02Z Masaya Tojo # Tag v1.0.0-dev1. + transaction_type_to_integer [transactions] 2023-03-04T09:32:34Z Masaya Tojo # Make transaction type integer. insert_transaction [insert_transaction@v1.0.0-dev1 appschema transactions] 2023-03-04T10:40:25Z Masaya Tojo # Change insert_transaction signature to use integer. transaction_type [transaction_type@v1.0.0-dev1 appschema] 2023-03-04T11:13:26Z Masaya Tojo # Drop transaction_type. @v1.0.0-dev2 2023-03-04T11:24:20Z Masaya Tojo # Tag v1.0.0-dev2. + +types [appschema] 2023-03-05T03:45:31Z Masaya Tojo # Add types table for manage type column of transactions. diff --git a/verify/types.sql b/verify/types.sql new file mode 100644 index 0000000..0e91d6f --- /dev/null +++ b/verify/types.sql @@ -0,0 +1,10 @@ +-- Verify kakeibo:types on pg + +BEGIN; + +SELECT code, + name + FROM kakeibo.types + WHERE FALSE; + +ROLLBACK; -- cgit v1.2.3