diff --git a/data/armor.sql b/data/armor.sql index 750d361..f67cd13 100644 --- a/data/armor.sql +++ b/data/armor.sql @@ -4,17 +4,15 @@ PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned INSERT INTO armorgroup ( grp_id, - sources_id, - sources_pages, short_name, descr ) VALUES -- TODO fill in the TODO parts with the description text from pg 275 - (1, 1, '275', 'Chain', 'TODO'), - (2, 1, '275', 'Composite', 'TODO'), - (3, 1, '275', 'Leather', 'TODO'), - (4, 1, '275', 'Plate', 'TODO'); + (1, 'Chain', 'TODO'), + (2, 'Composite', 'TODO'), + (3, 'Leather', 'TODO'), + (4, 'Plate', 'TODO'); INSERT INTO armorcategory (armor_category_id, short_name) VALUES @@ -26,8 +24,6 @@ VALUES INSERT INTO armor ( armor_id, - sources_id, - sources_pages, armor_category_id, item_level, short_name, @@ -44,22 +40,22 @@ INSERT INTO armor ( ) VALUES -- unarmored - (1, 1, '275', 1, 0, 'No armor', '-', 0.0, 0, NULL, NULL, NULL, NULL, 1, NULL, 'TODO'), - (2, 1, '275', 1, 0, 'Explorer''s clothing', '1 sp', 0.1, 0, 5, NULL, NULL, NULL, 2, NULL, 'TODO'), + (1, 1, 0, 'No armor', '-', 0.0, 0, NULL, NULL, NULL, NULL, 1, NULL, 'TODO'), + (2, 1, 0, 'Explorer''s clothing', '1 sp', 0.1, 0, 5, NULL, NULL, NULL, 2, NULL, 'TODO'), -- light armor - (3, 1, '275', 2, 0, 'Padded armor', '2 sp', 0.2, 1, 3, NULL, NULL, 10, 2, NULL, 'TODO'), - (4, 1, '275', 2, 0, 'Leather', '2 gp', 2.0, 1, 4, -1, NULL, 10, 3, NULL, 'TODO'), - (5, 1, '275', 2, 0, 'Studded leather', '3 gp', 3.0, 2, 3, -1, NULL, 12, 3, NULL, 'TODO'), - (6, 1, '275', 2, 0, 'Chain shirt', '5 gp', 5.0, 2, 3, -1, NULL, 12, 3, NULL, 'TODO'), + (3, 2, 0, 'Padded armor', '2 sp', 0.2, 1, 3, NULL, NULL, 10, 2, NULL, 'TODO'), + (4, 2, 0, 'Leather', '2 gp', 2.0, 1, 4, -1, NULL, 10, 3, NULL, 'TODO'), + (5, 2, 0, 'Studded leather', '3 gp', 3.0, 2, 3, -1, NULL, 12, 3, NULL, 'TODO'), + (6, 2, 0, 'Chain shirt', '5 gp', 5.0, 2, 3, -1, NULL, 12, 3, NULL, 'TODO'), -- medium armor - (7, 1, '275', 3, 0, 'Hide', '2 gp', 2.0, 3, 2, -2, -5, 14, 4, 3, 'TODO'), - (8, 1, '275', 3, 0, 'Scale mail', '4 gp', 4.0, 3, 2, -2, -5, 14, 4, 2, 'TODO'), - (9, 1, '275', 3, 0, 'Chain mail', '6 gp', 6.0, 4, 1, -2, -5, 16, 4, 1, 'TODO'), - (10, 1, '275', 3, 0, 'Breastplate', '8 gp', 8.0, 4, 1, -2, -5, 16, 4, 4, 'TODO'), + (7, 3, 0, 'Hide', '2 gp', 2.0, 3, 2, -2, -5, 14, 4, 3, 'TODO'), + (8, 3, 0, 'Scale mail', '4 gp', 4.0, 3, 2, -2, -5, 14, 4, 2, 'TODO'), + (9, 3, 0, 'Chain mail', '6 gp', 6.0, 4, 1, -2, -5, 16, 4, 1, 'TODO'), + (10, 3, 0, 'Breastplate', '8 gp', 8.0, 4, 1, -2, -5, 16, 4, 4, 'TODO'), -- heavy armor - (11, 1, '275', 4, 1, 'Splint mail', '13 gp', 13.0, 5, 1, -3, -10, 16, 5, 2, 'TODO'), - (12, 1, '275', 4, 1, 'Half plate', '18 gp', 18.0, 5, 1, -3, -10, 16, 5, 4, 'TODO'), - (13, 1, '275', 4, 2, 'Full plate', '30 gp', 30.0, 6, 0, -3, -10, 18, 6, 4, 'TODO'); + (11, 4, 1, 'Splint mail', '13 gp', 13.0, 5, 1, -3, -10, 16, 5, 2, 'TODO'), + (12, 4, 1, 'Half plate', '18 gp', 18.0, 5, 1, -3, -10, 16, 5, 4, 'TODO'), + (13, 4, 2, 'Full plate', '30 gp', 30.0, 6, 0, -3, -10, 18, 6, 4, 'TODO'); -- TODO INSERT into armor_traits table @@ -72,3 +68,47 @@ VALUES (9, 89), -- chain mail flexible (9, 90), -- chain mail noisy (13, 87); -- full plate bulwark + +INSERT INTO sourceentries ( + sourceentry_id + ,sources_id + ,page_start + ,page_stop +) +VALUES + -- 400 to 499 is reserved for CRB armour -- + (400, 1, 275, 275) -- Chain, Composite, Leather, Plate, No armor, Explorer's clothing, Padded armor, Leather, Studded leather, Chain shirt, Hide, Scale mail, Chain mail, Breastplate, Splint mail, Half plate, Full plate -- +; + +INSERT INTO armorgroup_sorceentries ( + id + ,grp_id + ,sourceentry_id +) +VALUES + (1, 1, 400) -- Chain -- + ,(2, 2, 400) -- Composite -- + ,(3, 3, 400) -- Leather -- + ,(4, 4, 400) -- Plate -- +; + +INSERT INTO armor_sorceentries ( + id + ,armor_id + ,sourceentry_id +) +VALUES + (1, 1, 400) -- No armor -- + ,(2, 2, 400) -- Explorer's clothing -- + ,(3, 3, 400) -- Padded armor -- + ,(4, 4, 400) -- Leather -- + ,(5, 5, 400) -- Studded leather -- + ,(6, 6, 400) -- Chain shirt -- + ,(7, 7, 400) -- Hide -- + ,(8, 8, 400) -- Scale mail -- + ,(9, 9, 400) -- Chain mail -- + ,(10, 10, 400) -- Breastplate -- + ,(11, 11, 400) -- Splint mail -- + ,(12, 12, 400) -- Half mail -- + ,(13, 13, 400) -- Full plate -- +; \ No newline at end of file diff --git a/schema/armor.sql b/schema/armor.sql index 9669bde..9d22c66 100644 --- a/schema/armor.sql +++ b/schema/armor.sql @@ -1,8 +1,6 @@ CREATE TABLE armorgroup ( grp_id INTEGER PRIMARY KEY, - sources_id INTEGER NOT NULL, - sources_pages TEXT NOT NULL, short_name TEXT NOT NULL UNIQUE, descr TEXT NOT NULL, FOREIGN KEY (sources_id) REFERENCES sources(sources_id) @@ -15,8 +13,6 @@ CREATE TABLE armorcategory ( CREATE TABLE armor ( armor_id INTEGER PRIMARY KEY, - sources_id INTEGER NOT NULL, - sources_pages TEXT, armor_category_id INTEGER NOT NULL, short_name TEXT NOT NULL, item_level INTEGER, @@ -43,4 +39,22 @@ CREATE TABLE armor_traits ( FOREIGN KEY (trait_id) REFERENCES traits(trait_id) ); +-- Joining table -- +CREATE TABLE armorgroup_sorceentries ( + id INTEGER PRIMARY KEY + ,grp_id INTEGER NOT NULL + ,sourceentry_id INTEGER NOT NULL + ,UNIQUE (id, grp_id, soruceentry_id), + ,FOREIGN KEY (grp_id) REFERENCES armorgroup(grp_id) + ,FOREIGN KEY (sourceentry_id) REFERENCES sourceentries(sourceentry_id) +); +-- Joining table -- +CREATE TABLE armor_sourceentries ( + id INTEGER PRIMARY KEY + ,armor_id INTEGER NOT NULL + ,sourceentry_id INTEGER NOT NULL + ,UNIQUE (id, armor_id, soruceentry_id), + ,FOREIGN KEY (armor_id) REFERENCES armor(armor_id) + ,FOREIGN KEY (sourceentry_id) REFERENCES sourceentries(sourceentry_id) +); \ No newline at end of file