From 248017b5b50f4e00c909abc234ed71b4dced9f37 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Mon, 13 Mar 2023 00:49:16 +0900 Subject: Add foreign key constraint to transactions table referencing types table. --- deploy/transactions.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'deploy/transactions.sql') diff --git a/deploy/transactions.sql b/deploy/transactions.sql index 0572a23..3a4585a 100644 --- a/deploy/transactions.sql +++ b/deploy/transactions.sql @@ -5,8 +5,8 @@ BEGIN; ALTER TABLE kakeibo.transactions - ADD COLUMN article_id INTEGER, - ADD CONSTRAINT transactions_article_id_fkey - FOREIGN KEY (article_id) REFERENCES kakeibo.articles (id); + ADD CONSTRAINT transactions_type_code_fkey + FOREIGN KEY (type_code) + REFERENCES kakeibo.transaction_types (code); COMMIT; -- cgit v1.2.3