init rust db backend

This commit is contained in:
2019-06-11 16:14:10 +02:00
parent ba1792ef55
commit 4454bd245c
16 changed files with 204 additions and 2 deletions
View File
@@ -0,0 +1,2 @@
DROP TABLE items;
@@ -0,0 +1,5 @@
CREATE TABLE items (
id INTEGER PRIMARY KEY,
name VARCHAR NOT NULL,
base_price INTEGER NOT NULL
);
@@ -0,0 +1 @@
DROP TABLE players;
@@ -0,0 +1,9 @@
CREATE TABLE players (
id INTEGER PRIMARY KEY,
name VARCHAR NOT NULL,
debt INTEGER DEFAULT 0, -- debt to the group in copper pieces
cp INTEGER DEFAULT 0,
sp INTEGER DEFAULT 0,
gp INTEGER DEFAULT 0,
pp INTEGER DEFAULT 0
);
@@ -0,0 +1 @@
DROP TABLE looted;
@@ -0,0 +1,8 @@
CREATE TABLE looted (
id INTEGER PRIMARY KEY,
player_id INTEGER NOT NULL,
item_id INTEGER NOT NULL,
acquired_date DATE DEFAULT NOW,
FOREIGN KEY (player_id) REFERENCES players(id),
FOREIGN KEY (item_id) REFERENCES items(id)
);