diff --git a/data/weapons.sql b/data/weapons.sql new file mode 100644 index 0000000..337e96e --- /dev/null +++ b/data/weapons.sql @@ -0,0 +1,29 @@ +-- -*- mode:sql sql-product:sqlite -*- + +PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned + -- on PER CONNECTION + +BEGIN TRANSACTION; +INSERT INTO weapongroups VALUES(1,1,'283','Axe','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(2,1,'284','Bomb','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(3,1,'284','Bow','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(4,1,'284','Brawling','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(5,1,'284','Club','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(6,1,'284','Dart','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(7,1,'284','Flail','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(8,1,'284','Hammer','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(9,1,'284','Knife','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(10,1,'284','Pick','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(11,1,'284','Polearm','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(12,1,'284','Shield','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(13,1,'284','Sling','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(14,1,'284','Spear','TODO descr from pg 283-84'); +INSERT INTO weapongroups VALUES(15,1,'284','Sword','TODO descr from pg 283-84'); +COMMIT; + +BEGIN TRANSACTION; +INSERT INTO weaponcategories VALUES(1, 'Unarmed'); +INSERT INTO weaponcategories VALUES(2, 'Simple'); +INSERT INTO weaponcategories VALUES(3, 'Martial'); +INSERT INTO weaponcategories VALUES(4, 'Advanced'); +COMMIT; diff --git a/schema/weapons.sql b/schema/weapons.sql new file mode 100644 index 0000000..b03aaf0 --- /dev/null +++ b/schema/weapons.sql @@ -0,0 +1,48 @@ +-- -*- mode:sql sql-product:sqlite -*- + +PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned + -- on PER CONNECTION + +CREATE TABLE weapongroups ( + weapongroups_id INTEGER PRIMARY KEY, + sources_id INTEGER, + sources_pages TEXT, + "name" TEXT NOT NULL UNIQUE, + descr TEXT, + FOREIGN KEY (sources_id) REFERENCES sources(sources_id) +); + +CREATE TABLE weaponcategories ( + weaponcategories_id INTEGER PRIMARY KEY, + "name" TEXT NOT NULL UNIQUE +); + +CREATE TABLE weapons ( + weapons_id INTEGER PRIMARY KEY, + sources_id INTEGER, + sources_pages TEXT, + weaponcategories_id INTEGER, + weapongroups_id INTEGER, + price_gp REAL, + dice_size INTEGER, + damagetypes_id INTEGER, + "bulk" REAL, + hands TEXT, -- '1+' is different than '1' per the rules + range INTEGER, + reload TEXT, -- '-' is significant in the rules + "name" TEXT NOT NULL UNIQUE, + descr TEXT, + FOREIGN KEY (weapongroups_id) REFERENCES weapongroups(weapongroups_id), + FOREIGN KEY (weaponcategories_id) REFERENCES weaponcategories(weaponcategories_id), + FOREIGN KEY (sources_id) REFERENCES sources(sources_id) +); + +CREATE TABLE weapons_traits ( + id INTEGER PRIMARY KEY, + weapons_id INTEGER NOT NULL, + trait_id INTEGER NOT NULL, + UNIQUE(weapons_id, trait_id) + FOREIGN KEY (weapons_id) REFERENCES weapons(weapons_id), + FOREIGN KEY (trait_id) REFERENCes traits(trait_id) +); +