2019-08-16 00:26:45 -04:00
|
|
|
-- -*- mode:sql sql-product:sqlite -*-
|
|
|
|
|
|
|
|
PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned
|
|
|
|
-- on PER CONNECTION
|
|
|
|
|
|
|
|
CREATE TABLE ammunition (
|
|
|
|
ammunition_id INTEGER PRIMARY KEY,
|
|
|
|
"name" TEXT NOT NULL UNIQUE,
|
|
|
|
price_gp REAL,
|
|
|
|
amount INTEGER,
|
|
|
|
bulk REAL,
|
|
|
|
descr TEXT,
|
2019-09-04 18:35:29 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
-- Joining table --
|
|
|
|
CREATE TABLE ammunition_sourceentries (
|
|
|
|
id INTEGER PRIMARY KEY
|
|
|
|
,ammunition_id INTEGER NOT NULL
|
|
|
|
,sourceentry_id INTEGER NOT NULL
|
2019-09-06 18:03:42 -04:00
|
|
|
,UNIQUE (id, ammunition_id, sourceentry_id)
|
2019-09-04 18:35:29 -04:00
|
|
|
,FOREIGN KEY (ammunition_id) REFERENCES ammunition(ammunition_id)
|
2019-09-04 19:30:11 -04:00
|
|
|
,FOREIGN KEY (sourceentry_id) REFERENCES sourceentries(sourceentry_id)
|
2019-09-04 18:35:29 -04:00
|
|
|
);
|