updates table schema

This commit is contained in:
2019-06-21 13:57:36 +02:00
parent 472e24a62c
commit 0f77a16a8c
10 changed files with 50 additions and 26 deletions

View File

@@ -1,2 +1,3 @@
DROP TABLE items;
DROP TABLE looted;

View File

@@ -1,5 +1,15 @@
-- The global inventory of items
CREATE TABLE items (
id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR NOT NULL,
base_price INTEGER NOT NULL
);
-- The items that have been looted
CREATE TABLE looted (
id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR NOT NULL,
base_price INTEGER NOT NULL,
owner_id INTEGER NOT NULL,
FOREIGN KEY (owner_id) REFERENCES players(id)
);

View File

@@ -7,3 +7,5 @@ CREATE TABLE players (
gp INTEGER DEFAULT 0 NOT NULL,
pp INTEGER DEFAULT 0 NOT NULL
);
INSERT INTO players (id, name) VALUES (0, 'Groupe');

View File

@@ -1 +0,0 @@
DROP TABLE looted;

View File

@@ -1,8 +0,0 @@
CREATE TABLE looted (
id INTEGER PRIMARY KEY NOT NULL,
player_id INTEGER NOT NULL,
item_id INTEGER NOT NULL,
acquired_date DATE NOT NULL,
FOREIGN KEY (player_id) REFERENCES players(id),
FOREIGN KEY (item_id) REFERENCES items(id)
);

View File

@@ -0,0 +1 @@
DROP TABLE claims;

View File

@@ -0,0 +1,8 @@
CREATE TABLE claims (
id INTEGER PRIMARY KEY NOT NULL,
player_id INTEGER NOT NULL,
loot_id INTEGER NOT NULL,
resolve INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (player_id) REFERENCES players(id),
FOREIGN KEY (loot_id) REFERENCES looted(id)
);