From 4d7ccd65f41d01babc8e438283456de0627e2ff5 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Wed, 19 Apr 2023 09:55:20 +0900 Subject: Revert "Rename type_code column to type and change type to transaction_type." This reverts commit 5d7203d5ca85c44391d4bb250f8fbb6ecd7afd29. --- deploy/kakeibo.transactions.sql | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'deploy/kakeibo.transactions.sql') 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; -- cgit v1.2.3