forked from jpeterbaker/bga_homeworlds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbmodel.sql
44 lines (37 loc) · 1.77 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
39
40
41
42
43
-- ------
-- 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
-- On Jonathan's computer, player schema described in ~/bga/player_schema.png
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)
-- Corresponds to Systems.system_id
`system_id` smallint UNSIGNED DEFAULT NULL,
-- Play-order number of owning player (null for star or bank)
-- Corresponds to player.player_id
`owner_id` int UNSIGNED DEFAULT NULL,
-- True if values have been remembered in the saved_* columns
-- `saved` BOOLEAN NOT NULL DEFAULT FALSE,
-- 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;
-- CREATE TABLE IF NOT EXISTS `Systems` (
-- `system_id` int NOT NULL PRIMARY KEY AUTO_INCREMENT,
-- `system_name` VARCHAR(40) DEFAULT NULL,
-- -- Corresponds to player.player_id or NULL for a colony
-- `homeplayer_id` int UNSIGNED DEFAULT NULL
-- ) ENGINE=InnoDB;