|
|
@@ -84,8 +84,8 @@ func sqlInit() error { |
|
|
|
"INSERT INTO Keys(id, token, player, time, metadata) VALUES ($1, $2, $3, $4, $5) ON CONFLICT(id) DO UPDATE SET token=$2, player=$3, time=$4, metadata=$5;", |
|
|
|
"CREATE TABLE IF NOT EXISTS Players (id BIGSERIAL PRIMARY KEY, name TEXT NOT NULL);", |
|
|
|
"CREATE TABLE IF NOT EXISTS Boards (id BIGSERIAL PRIMARY KEY, name TEXT NOT NULL, description TEXT NOT NULL);", |
|
|
|
"CREATE TABLE IF NOT EXISTS Entries (id BIGSERIAL PRIMARY KEY, rank INTEGER NOT NULL DEFAULT -1, score INTEGER NOT NULL, player INTEGER NOT NULL, board INTEGER NOT NULL, time INTEGER NOT NULL, metadata BYTEA NOT NULL DEFAULT E'\\\\xFF', FOREIGN KEY(player) REFERENCES Players(id), FOREIGN KEY(board) REFERENCES Boards(id));", |
|
|
|
"CREATE TABLE IF NOT EXISTS Keys (id BIGSERIAL PRIMARY KEY, token TEXT NOT NULL, player INTEGER NOT NULL, time INTEGER NOT NULL, metadata BYTEA NOT NULL DEFAULT E'\\\\xFF', FOREIGN KEY(player) REFERENCES Players(id));", |
|
|
|
"CREATE TABLE IF NOT EXISTS Entries (id BIGSERIAL PRIMARY KEY, rank INTEGER NOT NULL DEFAULT -1, score BIGINT NOT NULL, player BIGSERIAL NOT NULL, board BIGSERIAL NOT NULL, time INTEGER NOT NULL, metadata BYTEA NOT NULL DEFAULT E'\\\\xFF', FOREIGN KEY(player) REFERENCES Players(id), FOREIGN KEY(board) REFERENCES Boards(id));", |
|
|
|
"CREATE TABLE IF NOT EXISTS Keys (id BIGSERIAL PRIMARY KEY, token TEXT NOT NULL, player BIGSERIAL NOT NULL, time BIGSERIAL NOT NULL, metadata BYTEA NOT NULL DEFAULT E'\\\\xFF', FOREIGN KEY(player) REFERENCES Players(id));", |
|
|
|
}, |
|
|
|
} |
|
|
|
fmt.Printf("SQL Server %s is query type %d\n", sqlServer, queryType) |
|
|
|