adds server to serve the static files, fixes db tables

This commit is contained in:
2019-06-18 15:44:49 +02:00
parent ef9124cc74
commit 9b3df58a08
9 changed files with 44 additions and 19 deletions

Binary file not shown.

View File

@@ -1,5 +1,5 @@
CREATE TABLE items (
id INTEGER PRIMARY KEY,
id INTEGER PRIMARY KEY NOT NULL,
name VARCHAR NOT NULL,
base_price INTEGER NOT NULL
);

View File

@@ -1,9 +1,9 @@
CREATE TABLE players (
id INTEGER PRIMARY KEY,
id INTEGER PRIMARY KEY NOT NULL,
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
debt INTEGER DEFAULT 0 NOT NULL, -- debt to the group in copper pieces
cp INTEGER DEFAULT 0 NOT NULL,
sp INTEGER DEFAULT 0 NOT NULL,
gp INTEGER DEFAULT 0 NOT NULL,
pp INTEGER DEFAULT 0 NOT NULL
);

View File

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

View File

@@ -23,7 +23,6 @@ pub fn list_players() -> Vec<models::Player> {
players
.load::<models::Player>(&conn)
.expect("Error loading players")
.collect()
}

View File

@@ -1,6 +1,6 @@
table! {
items (id) {
id -> Nullable<Integer>,
id -> Integer,
name -> Text,
base_price -> Integer,
}
@@ -8,22 +8,22 @@ table! {
table! {
looted (id) {
id -> Nullable<Integer>,
id -> Integer,
player_id -> Integer,
item_id -> Integer,
acquired_date -> Nullable<Date>,
acquired_date -> Date,
}
}
table! {
players (id) {
id -> Nullable<Integer>,
id -> Integer,
name -> Text,
debt -> Nullable<Integer>,
cp -> Nullable<Integer>,
sp -> Nullable<Integer>,
gp -> Nullable<Integer>,
pp -> Nullable<Integer>,
debt -> Integer,
cp -> Integer,
sp -> Integer,
gp -> Integer,
pp -> Integer,
}
}