Ammunition sourceEntry conversion

source_entries
Brian Haley 2019-09-04 18:35:29 -04:00
parent f14b792ba2
commit d7e768641c
2 changed files with 40 additions and 8 deletions

View File

@ -4,8 +4,33 @@ PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned
-- on PER CONNECTION
BEGIN TRANSACTION;
INSERT INTO ammunition VALUES(1,1,'282','Arrows',0.1,10,0.1,'These projectiles are the ammunition for bows. The shaft of an arrow is made of wood. It is stabilized in flight by fletching at one end and bears a metal head on the other.');
INSERT INTO ammunition VALUES(2,1,'281','Blowgun Darts',0.05,10,0.1,'These thin, light darts are typically made of hardwood and stabilized with fletching of down or fur. They are often hollow so they can be used to deliver poison.');
INSERT INTO ammunition VALUES(3,1,'281','Bolts',0.1,10,0.1,'Shorter than traditional arrows but similar in construction, bolts are the ammunition used by crossbows.');
INSERT INTO ammunition VALUES(4,1,'281','Sling Bullets',0.01,10,0.1,'These are small metal balls, typically either iron or lead, designed to be used as ammunition in slings.');
INSERT INTO ammunition ()
VALUES(1,'Arrows',0.1,10,0.1,'These projectiles are the ammunition for bows. The shaft of an arrow is made of wood. It is stabilized in flight by fletching at one end and bears a metal head on the other.');
INSERT INTO ammunition VALUES(2,'Blowgun Darts',0.05,10,0.1,'These thin, light darts are typically made of hardwood and stabilized with fletching of down or fur. They are often hollow so they can be used to deliver poison.');
INSERT INTO ammunition VALUES(3,'Bolts',0.1,10,0.1,'Shorter than traditional arrows but similar in construction, bolts are the ammunition used by crossbows.');
INSERT INTO ammunition VALUES(4,'Sling Bullets',0.01,10,0.1,'These are small metal balls, typically either iron or lead, designed to be used as ammunition in slings.');
INSERT INTO sourceentries (
sourceentry_id
,sources_id
,page_start
,page_stop
)
VALUES
-- 50 to 99 is reserved for ammunition --
(50, 1, 282, 282) -- Arrows --
(51, 1, 281, 281) -- Blowgun darts, Bolts, Sling bullets --
;
INSERT INTO ammunition_sourceentries (
id
,ammunition_id
,sourceentry_id
)
VALUES
(1, 1, 50) -- Arrows --
(2, 2, 51) -- Blowgun darts --
(3, 3, 51) -- Bolts --
(4, 4, 51) -- Sling bullets --
;
COMMIT;

View File

@ -5,12 +5,19 @@ PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned
CREATE TABLE ammunition (
ammunition_id INTEGER PRIMARY KEY,
sources_id INTEGER,
sources_pages TEXT,
"name" TEXT NOT NULL UNIQUE,
price_gp REAL,
amount INTEGER,
bulk REAL,
descr TEXT,
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
)
);
-- Joining table --
CREATE TABLE ammunition_sourceentries (
id INTEGER PRIMARY KEY
,ammunition_id INTEGER NOT NULL
,sourceentry_id INTEGER NOT NULL
,UNIQUE (id, ammunition_id, sourceentry_id),
,FOREIGN KEY (ammunition_id) REFERENCES ammunition(ammunition_id)
,FOREIGN KEY (sourceentry_id) REFERENCES sourceentry(sourceentry_id)
);