aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2023-04-19 09:55:20 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2023-04-19 09:55:20 +0900
commit4d7ccd65f41d01babc8e438283456de0627e2ff5 (patch)
tree70a3de0a5cc730691cf9ac685a44dbdba3ec2709
parent5d7203d5ca85c44391d4bb250f8fbb6ecd7afd29 (diff)
Revert "Rename type_code column to type and change type to transaction_type."
This reverts commit 5d7203d5ca85c44391d4bb250f8fbb6ecd7afd29.
-rw-r--r--deploy/kakeibo.transactions.sql9
-rw-r--r--deploy/kakeibo.transactions@v1.0.0-alpha.4.sql12
-rw-r--r--revert/kakeibo.transactions.sql8
-rw-r--r--revert/kakeibo.transactions@v1.0.0-alpha.4.sql8
-rw-r--r--sqitch.plan1
-rw-r--r--verify/kakeibo.transactions.sql2
-rw-r--r--verify/kakeibo.transactions@v1.0.0-alpha.4.sql15
7 files changed, 6 insertions, 49 deletions
diff --git a/deploy/kakeibo.transactions.sql b/deploy/kakeibo.transactions.sql
index 6e0787f..0572a23 100644
--- a/deploy/kakeibo.transactions.sql
+++ b/deploy/kakeibo.transactions.sql
@@ -2,14 +2,11 @@
-- requires: schema
-- requires: articles
-
BEGIN;
-ALTER TABLE kakeibo.transactions RENAME COLUMN type_code TO type;
ALTER TABLE kakeibo.transactions
- ALTER COLUMN type TYPE kakeibo.transaction_type
- USING CASE type WHEN 0
- THEN 'outgo'::kakeibo.transaction_type
- ELSE 'income'::kakeibo.transaction_type END;
+ ADD COLUMN article_id INTEGER,
+ ADD CONSTRAINT transactions_article_id_fkey
+ FOREIGN KEY (article_id) REFERENCES kakeibo.articles (id);
COMMIT;
diff --git a/deploy/kakeibo.transactions@v1.0.0-alpha.4.sql b/deploy/kakeibo.transactions@v1.0.0-alpha.4.sql
deleted file mode 100644
index 0572a23..0000000
--- a/deploy/kakeibo.transactions@v1.0.0-alpha.4.sql
+++ /dev/null
@@ -1,12 +0,0 @@
--- Deploy kakeibo:transactions to pg
--- requires: schema
--- 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/kakeibo.transactions.sql b/revert/kakeibo.transactions.sql
index a31898f..d30390a 100644
--- a/revert/kakeibo.transactions.sql
+++ b/revert/kakeibo.transactions.sql
@@ -1,12 +1,8 @@
--- Deploy kakeibo:transactions to pg
--- requires: schema
--- requires: articles
+-- Revert kakeibo:transactions from pg
BEGIN;
-ALTER TABLE kakeibo.transactions RENAME COLUMN type TO type_code;
ALTER TABLE kakeibo.transactions
- ALTER COLUMN type_code TYPE integer
- USING CASE type_code WHEN 'outgo' THEN 0 ELSE 1 END;
+ DROP COLUMN article_id;
COMMIT;
diff --git a/revert/kakeibo.transactions@v1.0.0-alpha.4.sql b/revert/kakeibo.transactions@v1.0.0-alpha.4.sql
deleted file mode 100644
index d30390a..0000000
--- a/revert/kakeibo.transactions@v1.0.0-alpha.4.sql
+++ /dev/null
@@ -1,8 +0,0 @@
--- Revert kakeibo:transactions from pg
-
-BEGIN;
-
-ALTER TABLE kakeibo.transactions
- DROP COLUMN article_id;
-
-COMMIT;
diff --git a/sqitch.plan b/sqitch.plan
index f353f40..54ded53 100644
--- a/sqitch.plan
+++ b/sqitch.plan
@@ -29,4 +29,3 @@ photo.photos [photo] 2023-03-27T16:00:51Z Masaya Tojo <masaya@tojo.tokyo> # Add
@v1.0.0-alpha.4 2023-04-08T04:58:15Z Masaya Tojo <masaya@tojo.tokyo> # Tag v1.0.0-alpha.4
kakeibo.transaction_type [kakeibo] 2023-04-08T05:28:15Z Masaya Tojo <masaya@tojo.tokyo> # Add `transaction_type` enum type.
-kakeibo.transactions [kakeibo.transactions@v1.0.0-alpha.4 kakeibo.transaction_type] 2023-04-08T05:50:31Z Masaya Tojo <masaya@tojo.tokyo> # Rename type_code column to type and change data type from integer to transaction_type.
diff --git a/verify/kakeibo.transactions.sql b/verify/kakeibo.transactions.sql
index 3dc2a9a..3f5b58f 100644
--- a/verify/kakeibo.transactions.sql
+++ b/verify/kakeibo.transactions.sql
@@ -3,7 +3,7 @@
BEGIN;
SELECT id,
- type,
+ type_code,
date,
note,
created_at,
diff --git a/verify/kakeibo.transactions@v1.0.0-alpha.4.sql b/verify/kakeibo.transactions@v1.0.0-alpha.4.sql
deleted file mode 100644
index 3f5b58f..0000000
--- a/verify/kakeibo.transactions@v1.0.0-alpha.4.sql
+++ /dev/null
@@ -1,15 +0,0 @@
--- Verify kakeibo:transactions on pg
-
-BEGIN;
-
-SELECT id,
- type_code,
- date,
- note,
- created_at,
- updated_at,
- article_id
- FROM kakeibo.transactions
- WHERE FALSE;
-
-ROLLBACK;