From 0122cf57f599cf32cd067979ef0ff1b9bac56870 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 7 Jun 2019 00:45:03 +0100 Subject: [PATCH] Add foreign key constraint to puffle hat column --- houdini.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/houdini.sql b/houdini.sql index 5acc739..142dcca 100644 --- a/houdini.sql +++ b/houdini.sql @@ -977,7 +977,7 @@ CREATE TABLE penguin_puffle ( rest SMALLINT NOT NULL DEFAULT 100, clean SMALLINT NOT NULL DEFAULT 100, walking BOOLEAN DEFAULT FALSE, - hat INT NOT NULL, + hat INT DEFAULT NULL, backyard BOOLEAN DEFAULT FALSE, has_dug BOOLEAN DEFAULT FALSE, PRIMARY KEY (id), @@ -1010,7 +1010,8 @@ CREATE TABLE penguin_puffle_item ( item_id INT NOT NULL, quantity SMALLINT NOT NULL, PRIMARY KEY (penguin_id, item_id), - CONSTRAINT penguin_puffle_item_ibfk_1 FOREIGN KEY (penguin_id) REFERENCES penguin (id) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT penguin_puffle_item_ibfk_1 FOREIGN KEY (penguin_id) REFERENCES penguin (id) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT penguin_puffle_item_ibfk_2 FOREIGN KEY (item_id) REFERENCES puffle_item (id) ON DELETE CASCADE ON UPDATE CASCADE ); COMMENT ON TABLE penguin_puffle_item IS 'Owned puffle care items';