aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2023-03-13 00:23:26 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2023-03-14 09:09:58 +0900
commitf011f99514c304521e14eb00b2c6e6d4b2c3dd11 (patch)
treec62fecf1393cd9b8525e2cbffd70e5fca0f0834d
parent16b03189283eeb212499681d9de5bc054346b184 (diff)
Add table to manage transaction type codes.
-rw-r--r--deploy/transaction_types.sql12
-rw-r--r--revert/transaction_types.sql7
-rw-r--r--sqitch.plan2
-rw-r--r--verify/transaction_types.sql10
4 files changed, 31 insertions, 0 deletions
diff --git a/deploy/transaction_types.sql b/deploy/transaction_types.sql
new file mode 100644
index 0000000..cf07925
--- /dev/null
+++ b/deploy/transaction_types.sql
@@ -0,0 +1,12 @@
+-- Deploy kakeibo:transaction_types to pg
+-- requires: schema
+
+BEGIN;
+
+CREATE TABLE kakeibo.transaction_types (
+ code INTEGER PRIMARY KEY,
+ name TEXT NOT NULL
+);
+INSERT INTO kakeibo.transaction_types VALUES (0, 'outgo'), (1, 'income');
+
+COMMIT;
diff --git a/revert/transaction_types.sql b/revert/transaction_types.sql
new file mode 100644
index 0000000..48df263
--- /dev/null
+++ b/revert/transaction_types.sql
@@ -0,0 +1,7 @@
+-- Revert kakeibo:transaction_types from pg
+
+BEGIN;
+
+DROP TABLE kakeibo.transaction_types;
+
+COMMIT;
diff --git a/sqitch.plan b/sqitch.plan
index cbd7806..870ff72 100644
--- a/sqitch.plan
+++ b/sqitch.plan
@@ -18,3 +18,5 @@ articles [schema] 2023-03-12T14:43:06Z Masaya Tojo <masaya@tojo.tokyo> # Add tab
transactions [transactions@v1.0.0-alpha.1 articles] 2023-03-12T15:06:03Z Masaya Tojo <masaya@tojo.tokyo> # Add article_id column to transactions table.
items [items@v1.0.0-alpha.1 articles] 2023-03-12T15:12:15Z Masaya Tojo <masaya@tojo.tokyo> # Add article_id column to items table.
@v1.0.0-alpha.2 2023-03-12T15:18:49Z Masaya Tojo <masaya@tojo.tokyo> # Tag v1.0.0-alpha.2.
+
+transaction_types [schema] 2023-03-12T15:20:07Z Masaya Tojo <masaya@tojo.tokyo> # Add table to manage transaction type codes.
diff --git a/verify/transaction_types.sql b/verify/transaction_types.sql
new file mode 100644
index 0000000..49aa2f6
--- /dev/null
+++ b/verify/transaction_types.sql
@@ -0,0 +1,10 @@
+-- Verify kakeibo:transaction_types on pg
+
+BEGIN;
+
+SELECT code,
+ name
+ FROM kakeibo.transaction_types
+ WHERE FALSE;
+
+ROLLBACK;