aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2023-03-05 12:49:00 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2023-03-05 12:49:00 +0900
commit4b552c58f5988d1af18ef34ccec5979081c3bc14 (patch)
treefb9b4bbbb5924491d31c471e47ed0607e21901fa
parent332309099a60fa5feefa88c880f92ba308881173 (diff)
Add types table for manage type column of transactions.
-rw-r--r--deploy/types.sql12
-rw-r--r--revert/types.sql7
-rw-r--r--sqitch.plan3
-rw-r--r--verify/types.sql10
4 files changed, 32 insertions, 0 deletions
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 <masaya@tojo.tokyo
transactions_update_timestamp [transactions update_timestamp] 2023-02-28T16:43:49Z Masaya Tojo <masaya@tojo.tokyo> # Add update_timestamp trigger to transactions table.
items_update_timestamp [items update_timestamp] 2023-02-28T17:04:02Z Masaya Tojo <masaya@tojo.tokyo> # Add update_timestamp trigger to items table.
@v1.0.0-dev1 2023-03-04T09:29:02Z Masaya Tojo <masaya@tojo.tokyo> # Tag v1.0.0-dev1.
+
transaction_type_to_integer [transactions] 2023-03-04T09:32:34Z Masaya Tojo <masaya@tojo.tokyo> # Make transaction type integer.
insert_transaction [insert_transaction@v1.0.0-dev1 appschema transactions] 2023-03-04T10:40:25Z Masaya Tojo <masaya@tojo.tokyo> # Change insert_transaction signature to use integer.
transaction_type [transaction_type@v1.0.0-dev1 appschema] 2023-03-04T11:13:26Z Masaya Tojo <masaya@tojo.tokyo> # Drop transaction_type.
@v1.0.0-dev2 2023-03-04T11:24:20Z Masaya Tojo <masaya@tojo.tokyo> # Tag v1.0.0-dev2.
+
+types [appschema] 2023-03-05T03:45:31Z Masaya Tojo <masaya@tojo.tokyo> # 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;