diff --git a/server/src/migrations/2020-12-13-172324_skills/down.sql b/server/src/migrations/2020-12-13-172324_skills/down.sql new file mode 100644 index 0000000000..72c61c6be2 --- /dev/null +++ b/server/src/migrations/2020-12-13-172324_skills/down.sql @@ -0,0 +1,4 @@ +-- Drops skill and skill_group tables + +DROP TABLE skill; +DROP TABLE skill_group; \ No newline at end of file diff --git a/server/src/migrations/2020-12-13-172324_skills/up.sql b/server/src/migrations/2020-12-13-172324_skills/up.sql new file mode 100644 index 0000000000..71e0fd676c --- /dev/null +++ b/server/src/migrations/2020-12-13-172324_skills/up.sql @@ -0,0 +1,22 @@ +-- Creates skill and skill_group tables. Adds General skill tree for players that are already created + +CREATE TABLE skill_group ( + character_id INTEGER NOT NULL, + skill_group_type TEXT NOT NULL, + exp INTEGER NOT NULL, + available_sp INTEGER NOT NULL, + FOREIGN KEY(character_id) REFERENCES character(character_id), + PRIMARY KEY(character_id,skill_group_type) +); + +CREATE TABLE skill ( + character_id INTEGER NOT NULL, + skill TEXT NOT NULL, + level INTEGER, + FOREIGN KEY(character_id) REFERENCES character(character_id), + PRIMARY KEY(character_id,skill) +); + +INSERT INTO skill_group +SELECT c.character_id, '"General"', 0, 0 +FROM character c \ No newline at end of file