diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2023-03-04 20:21:24 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2023-03-04 20:21:24 +0900 |
commit | 69ac90518f003895b8ffb6618b84b91ff4256308 (patch) | |
tree | a81c9562b8390afe2f0e5cebf06d019ab44e86ec | |
parent | 85aa0f7fa89cad0cd81af87336d7f9d31bb19422 (diff) |
Drop transaction_type.
-rw-r--r-- | deploy/transaction_type.sql | 5 | ||||
-rw-r--r-- | deploy/transaction_type@v1.0.0-dev1.sql | 11 | ||||
-rw-r--r-- | revert/transaction_type.sql | 8 | ||||
-rw-r--r-- | revert/transaction_type@v1.0.0-dev1.sql | 7 | ||||
-rw-r--r-- | sqitch.plan | 1 | ||||
-rw-r--r-- | verify/transaction_type.sql | 5 | ||||
-rw-r--r-- | verify/transaction_type@v1.0.0-dev1.sql | 11 |
7 files changed, 41 insertions, 7 deletions
diff --git a/deploy/transaction_type.sql b/deploy/transaction_type.sql index b29421f..a101f75 100644 --- a/deploy/transaction_type.sql +++ b/deploy/transaction_type.sql @@ -3,9 +3,6 @@ BEGIN; -CREATE TYPE kakeibo.transaction_type AS ENUM( - 'income', - 'outgo' -); +DROP TYPE kakeibo.transaction_type; COMMIT; diff --git a/deploy/transaction_type@v1.0.0-dev1.sql b/deploy/transaction_type@v1.0.0-dev1.sql new file mode 100644 index 0000000..b29421f --- /dev/null +++ b/deploy/transaction_type@v1.0.0-dev1.sql @@ -0,0 +1,11 @@ +-- Deploy kakeibo:transaction_type to pg +-- requires: appschema + +BEGIN; + +CREATE TYPE kakeibo.transaction_type AS ENUM( + 'income', + 'outgo' +); + +COMMIT; diff --git a/revert/transaction_type.sql b/revert/transaction_type.sql index 00fd491..b29421f 100644 --- a/revert/transaction_type.sql +++ b/revert/transaction_type.sql @@ -1,7 +1,11 @@ --- Revert kakeibo:transaction_type from pg +-- Deploy kakeibo:transaction_type to pg +-- requires: appschema BEGIN; -DROP TYPE kakeibo.transaction_type; +CREATE TYPE kakeibo.transaction_type AS ENUM( + 'income', + 'outgo' +); COMMIT; diff --git a/revert/transaction_type@v1.0.0-dev1.sql b/revert/transaction_type@v1.0.0-dev1.sql new file mode 100644 index 0000000..00fd491 --- /dev/null +++ b/revert/transaction_type@v1.0.0-dev1.sql @@ -0,0 +1,7 @@ +-- Revert kakeibo:transaction_type from pg + +BEGIN; + +DROP TYPE kakeibo.transaction_type; + +COMMIT; diff --git a/sqitch.plan b/sqitch.plan index ae95b66..7748b7d 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -16,3 +16,4 @@ items_update_timestamp [items update_timestamp] 2023-02-28T17:04:02Z Masaya Tojo @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. diff --git a/verify/transaction_type.sql b/verify/transaction_type.sql index 64de361..bce032f 100644 --- a/verify/transaction_type.sql +++ b/verify/transaction_type.sql @@ -3,8 +3,11 @@ BEGIN; DO $$ + DECLARE + type_count INTEGER; BEGIN - ASSERT (select 1 from pg_type where typname = 'transaction_type'); + SELECT COUNT(*) INTO type_count FROM pg_type where typname = 'transaction_type'; + ASSERT type_count = 0; END $$; diff --git a/verify/transaction_type@v1.0.0-dev1.sql b/verify/transaction_type@v1.0.0-dev1.sql new file mode 100644 index 0000000..64de361 --- /dev/null +++ b/verify/transaction_type@v1.0.0-dev1.sql @@ -0,0 +1,11 @@ +-- Verify kakeibo:transaction_type on pg + +BEGIN; + +DO $$ + BEGIN + ASSERT (select 1 from pg_type where typname = 'transaction_type'); + END +$$; + +ROLLBACK; |