aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2023-03-12 01:57:45 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2023-03-12 23:38:12 +0900
commit55618dcd6a40c0b85612a20994114a18987ff43d (patch)
tree60cd724f49d2b1536cd54ed28ca450b0347928f8
parent754001bf63c6ad0b18329f601360d470870704b8 (diff)
Add table for tracking transactions.
-rw-r--r--deploy/transactions.sql15
-rw-r--r--revert/transactions.sql7
-rw-r--r--sqitch.plan1
-rw-r--r--verify/transactions.sql14
4 files changed, 37 insertions, 0 deletions
diff --git a/deploy/transactions.sql b/deploy/transactions.sql
new file mode 100644
index 0000000..e37b276
--- /dev/null
+++ b/deploy/transactions.sql
@@ -0,0 +1,15 @@
+-- Deploy kakeibo:transactions to pg
+-- requires: schema
+
+BEGIN;
+
+CREATE TABLE kakeibo.transactions (
+ id SERIAL PRIMARY KEY,
+ type_code INTEGER,
+ date DATE NOT NULL,
+ note TEXT,
+ created_at TIMESTAMP NOT NULL DEFAULT NOW(),
+ updated_at TIMESTAMP NOT NULL DEFAULT NOW()
+);
+
+COMMIT;
diff --git a/revert/transactions.sql b/revert/transactions.sql
new file mode 100644
index 0000000..835ff3d
--- /dev/null
+++ b/revert/transactions.sql
@@ -0,0 +1,7 @@
+-- Revert kakeibo:transactions from pg
+
+BEGIN;
+
+DROP TABLE kakeibo.transactions;
+
+COMMIT;
diff --git a/sqitch.plan b/sqitch.plan
index 7d85dd3..bd18863 100644
--- a/sqitch.plan
+++ b/sqitch.plan
@@ -3,3 +3,4 @@
%uri=https://git.tojo.tokyo/kakeibo.git
schema 2023-03-11T15:56:41Z Masaya Tojo <masaya@tojo.tokyo> # Add schema for use in kakeibo.
+transactions [schema] 2023-03-11T16:50:25Z Masaya Tojo <masaya@tojo.tokyo> # Add table for tracking transactions.
diff --git a/verify/transactions.sql b/verify/transactions.sql
new file mode 100644
index 0000000..0cc1b2d
--- /dev/null
+++ b/verify/transactions.sql
@@ -0,0 +1,14 @@
+-- Verify kakeibo:transactions on pg
+
+BEGIN;
+
+SELECT id,
+ type_code,
+ date,
+ note,
+ created_at,
+ updated_at
+ FROM kakeibo.transactions
+ WHERE FALSE;
+
+ROLLBACK;