23 lines
672 B
SQL
23 lines
672 B
SQL
-- -*- 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,
|
|
);
|
|
|
|
-- 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)
|
|
); |