-
Notifications
You must be signed in to change notification settings - Fork 1
/
dbmodel.sql
39 lines (33 loc) · 1.5 KB
/
dbmodel.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- ------
-- BGA framework: © Gregory Isabelli <[email protected]> & Emmanuel Colin <[email protected]>
-- Homeworlds implementation : © Jonathan Baker <[email protected]>
--
-- This code has been produced on the BGA studio platform for use on http://boardgamearena.com.
-- See http://en.boardgamearena.com/#!doc/Studio for more information.
-- -----
-- dbmodel.sql
ALTER TABLE `player` ADD `homeworld_id` SMALLINT UNSIGNED DEFAULT NULL;
-- Each of the 36 pieces will be listed individually
CREATE TABLE IF NOT EXISTS `Pieces` (
-- getCollectionFromDb uses keys as array indices,
-- so it will be convenient to have a single key field
`piece_id` int NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- Piece color (1-4)
`color` tinyint UNSIGNED NOT NULL,
-- Piece size (1-3)
`pips` tinyint UNSIGNED NOT NULL,
-- System that this piece occupies (null for bank)
`system_id` smallint UNSIGNED DEFAULT NULL,
-- Owning player (null for star or bank)
-- Corresponds to player.player_id
`owner_id` int UNSIGNED DEFAULT NULL,
-- Saved values of system_id and owner_id for reverting to start of turn
`saved_system_id` smallint UNSIGNED DEFAULT NULL,
`saved_owner_id` int UNSIGNED DEFAULT NULL
) ENGINE=InnoDB;
-- String representations of every game state that has occurred
-- and how many times they have occurred
CREATE TABLE IF NOT EXISTS `States` (
`state_str` varchar(55) NOT NULL PRIMARY KEY,
`tally` int UNSIGNED NOT NULL DEFAULT 1
) ENGINE=InnoDB;