-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- This file should undo anything in `up.sql` | ||
|
||
--remove hp from building_type | ||
ALTER TABLE public.building_type | ||
DROP COLUMN hp; | ||
|
||
--remove cost name and level from emp | ||
ALTER TABLE public.emp_type | ||
DROP cost, | ||
DROP "name", | ||
DROP "level"; | ||
|
||
--remove name from attacker | ||
ALTER TABLE public.attacker_type | ||
DROP "name"; | ||
|
||
--remove attacker and emp from available_blocks | ||
ALTER TABLE public.available_blocks | ||
|
||
DROP CONSTRAINT attacker_id_fk, | ||
DROP attacker_type_id, | ||
DROP CONSTRAINT emp_id_fk, | ||
DROP emp_type_id, | ||
DROP category, | ||
DROP CONSTRAINT available_blocks_id_primary, | ||
DROP id, | ||
ALTER COLUMN block_type_id SET NOT NULL, | ||
ADD CONSTRAINT available_blocks_id_primary PRIMARY KEY(user_id, block_type_id); | ||
|
||
DROP TYPE item_category; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- Your SQL goes here | ||
|
||
--add hp to building_type | ||
ALTER TABLE public.building_type | ||
ADD COLUMN hp INTEGER NOT NULL; | ||
|
||
--add cost name and level to emp | ||
ALTER TABLE public.emp_type | ||
ADD cost INTEGER NOT NULL, | ||
ADD "name" VARCHAR(255) NOT NULL, | ||
ADD "level" INTEGER NOT NULL; | ||
|
||
--add name to attacker | ||
ALTER TABLE public.attacker_type | ||
ADD "name" VARCHAR(255) NOT NULL; | ||
|
||
--add attacker and emp to available_blocks | ||
CREATE TYPE item_category AS ENUM ('attacker', 'emp', 'block'); | ||
|
||
|
||
ALTER TABLE public.available_blocks | ||
|
||
ADD attacker_type_id INTEGER, | ||
ADD CONSTRAINT attacker_id_fk FOREIGN KEY (attacker_type_id) REFERENCES public.attacker_type(id), | ||
|
||
Add emp_type_id INTEGER, | ||
ADD CONSTRAINT emp_id_fk FOREIGN KEY (emp_type_id) REFERENCES public.emp_type(id), | ||
|
||
ADD category item_category NOT NULL, | ||
|
||
ADD id INTEGER NOT NULL, | ||
|
||
DROP CONSTRAINT available_blocks_id_primary, | ||
ADD CONSTRAINT available_blocks_id_primary PRIMARY KEY(id), | ||
|
||
ALTER COLUMN block_type_id DROP NOT NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters