-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: Add Migrations to CI and also break schema into smaller files (#27)
* ci: fix migrations, lots of typos, non-unique fks, add first modeling for spells and projectiles + check migrations in CI --------- Co-authored-by: EduardoLR10 <[email protected]>
- Loading branch information
1 parent
14d978f
commit 81768f6
Showing
14 changed files
with
514 additions
and
237 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,10 @@ VALUES ('Huneric', '[email protected]', 'mmagueta'), | |
('Gaiseric', '[email protected]', 'mmagueta'), | ||
('Legion', '[email protected]', 'lambdu'); | ||
|
||
INSERT INTO lyceum.character_stats (name, e_mail, username, constitution, wisdom, strength, endurance, intelligence, faith) | ||
VALUES ('Huneric', '[email protected]', 'mmagueta', 100, 110, 95, 120, 105, 100), | ||
('Gaiseric', '[email protected]', 'mmagueta', 60, 110, 55, 150, 150, 50), | ||
('Legion', '[email protected]', 'lambdu', 60, 110, 55, 150, 150, 50); | ||
INSERT INTO lyceum.character_stats (name, e_mail, username, constitution, wisdom, strength, endurance, intelligence, faith, mana, health) | ||
VALUES ('Huneric', '[email protected]', 'mmagueta', 100, 110, 95, 120, 105, 100, 100, 100), | ||
('Gaiseric', '[email protected]', 'mmagueta', 60, 110, 55, 150, 150, 50, 100, 100), | ||
('Legion', '[email protected]', 'lambdu', 60, 110, 55, 150, 150, 50, 100, 100); | ||
|
||
INSERT INTO lyceum.character_position (name, e_mail, username, x_position, y_position, map_name, face_direction) | ||
VALUES ('Huneric', '[email protected]', 'mmagueta', 10, 20, 'CASTLE_HALL', 270), | ||
|
@@ -35,3 +35,9 @@ VALUES ('Huneric', '[email protected]', 'mmagueta', true, 'Vandal''s Prima', | |
('Huneric', '[email protected]', 'mmagueta', true, 'Blood-Reaver''s Gauntlet', 'ARMS'::lyceum.equipment_use, 'ARMS'::lyceum.equipment_kind), | ||
('Gaiseric', '[email protected]', 'mmagueta', true, 'Vandal''s Prima', 'RIGHT_ARM', 'ARMS'::lyceum.equipment_kind), | ||
('Legion', '[email protected]', 'lambdu', true, 'Vandal''s Prima', 'RIGHT_ARM', 'ARMS'::lyceum.equipment_kind); | ||
|
||
-- Insert into lyceum.view_spell_destruction | ||
INSERT INTO lyceum.view_spell_destruction (name, description, cost, duration, cast_time, kind, target, base_damage, damage_kind, destruction_kind) | ||
VALUES ('Fire Ball', 'Something cool', 10, 50, 1, 'PROJECTILE'::lyceum.spell_type, 'SINGULAR'::lyceum.spell_target, 100, 'FIRE'::lyceum.spell_damage_type, 'MAGIC'::lyceum.spell_destruction_type), | ||
('Ice Ball', 'Another cool thing', 10, 50, 1, 'PROJECTILE'::lyceum.spell_type, 'SINGULAR'::lyceum.spell_target, 100, 'FIRE'::lyceum.spell_damage_type, 'MAGIC'::lyceum.spell_destruction_type); | ||
|
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 @@ | ||
CREATE SCHEMA IF NOT EXISTS lyceum; |
This file was deleted.
Oops, something went wrong.
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,53 @@ | ||
-- Defines: | ||
-- Tile Types | ||
-- Map | ||
-- Objects | ||
|
||
CREATE TYPE lyceum.TILE_TYPE AS ENUM( | ||
'WATER', | ||
'GRASS', | ||
'SAND', | ||
'ROCK' | ||
); | ||
|
||
CREATE TABLE lyceum.map( | ||
name VARCHAR(16) NOT NULL, | ||
PRIMARY KEY(name) | ||
); | ||
|
||
CREATE TABLE lyceum.tile( | ||
map_name VARCHAR(16) NOT NULL, | ||
kind lyceum.TILE_TYPE NOT NULL, | ||
x_position SMALLINT NOT NULL, | ||
y_position SMALLINT NOT NULL, | ||
PRIMARY KEY(map_name, kind, x_position, y_position), | ||
FOREIGN KEY (map_name) REFERENCES lyceum.map(name) | ||
); | ||
|
||
CREATE TABLE lyceum.object( | ||
map_name VARCHAR(16) NOT NULL, | ||
name VARCHAR(16) NOT NULL, | ||
x_position SMALLINT NOT NULL, | ||
y_position SMALLINT NOT NULL, | ||
PRIMARY KEY(map_name, x_position, y_position), | ||
FOREIGN KEY (map_name) REFERENCES lyceum.map(name) | ||
); | ||
|
||
CREATE OR REPLACE FUNCTION map_object_overlap() RETURNS trigger AS $map_object_overlap$ | ||
DECLARE | ||
kind TEXT; | ||
BEGIN | ||
SELECT kind INTO kind FROM tile WHERE x_position = NEW.x_position AND y_position = NEW.y_position; | ||
|
||
IF NEW.name = 'TREE' THEN | ||
IF kind <> 'GRASS' AND kind <> 'SAND' THEN | ||
RAISE EXCEPTION '''TREE'' cannot be defined in tiles that are not ''GRASS'' or ''SAND''.'; | ||
END IF; | ||
END IF; | ||
|
||
RETURN NEW; | ||
END; | ||
$map_object_overlap$ LANGUAGE plpgsql; | ||
|
||
CREATE TRIGGER map_object_overlap BEFORE INSERT OR UPDATE ON lyceum.object | ||
FOR EACH ROW EXECUTE FUNCTION map_object_overlap(); |
Oops, something went wrong.