diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2023-03-13 00:11:31 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2023-03-13 00:17:07 +0900 |
commit | 05b6e730fa81a4ec02fbf361967896f0c9f3a2d4 (patch) | |
tree | e14b724d2a81bd394cb3cf38b86e1671e491bb68 /deploy/transactions.sql | |
parent | aae863e98b35152e8e7c0efe7919dd105c229361 (diff) |
Add article_id column to transactions table.
Diffstat (limited to 'deploy/transactions.sql')
-rw-r--r-- | deploy/transactions.sql | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/deploy/transactions.sql b/deploy/transactions.sql index e37b276..0572a23 100644 --- a/deploy/transactions.sql +++ b/deploy/transactions.sql @@ -1,15 +1,12 @@ -- Deploy kakeibo:transactions to pg -- requires: schema +-- requires: articles 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() -); +ALTER TABLE kakeibo.transactions + ADD COLUMN article_id INTEGER, + ADD CONSTRAINT transactions_article_id_fkey + FOREIGN KEY (article_id) REFERENCES kakeibo.articles (id); COMMIT; |