<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://zh-cn.doc.boardgamearena.com/index.php?action=history&amp;feed=atom&amp;title=Game_database_model%3A_dbmodel.sql</id>
	<title>Game database model: dbmodel.sql - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://zh-cn.doc.boardgamearena.com/index.php?action=history&amp;feed=atom&amp;title=Game_database_model%3A_dbmodel.sql"/>
	<link rel="alternate" type="text/html" href="https://zh-cn.doc.boardgamearena.com/index.php?title=Game_database_model:_dbmodel.sql&amp;action=history"/>
	<updated>2026-10-12T02:33:52Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.39.0</generator>
	<entry>
		<id>https://zh-cn.doc.boardgamearena.com/index.php?title=Game_database_model:_dbmodel.sql&amp;diff=195&amp;oldid=prev</id>
		<title>2021年7月3日 (六) 12:17 Yeqing-</title>
		<link rel="alternate" type="text/html" href="https://zh-cn.doc.boardgamearena.com/index.php?title=Game_database_model:_dbmodel.sql&amp;diff=195&amp;oldid=prev"/>
		<updated>2021-07-03T12:17:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年7月3日 (六) 14:17的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Studio_Framework_Navigation}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Studio_Framework_Navigation}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;In this file you specify the database schema of your game.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;你在这个文件里指定游戏的database schema。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This file contains SQL queries that will be executed during the creation of your game table.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;这个文件包含了在创建你的游戏table时将会执行的SQL queries。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Note&lt;/del&gt;:&amp;#039;&amp;#039;&amp;#039; &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;you can&amp;#039;t change the database schema during the game.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;注意&lt;/ins&gt;:&amp;#039;&amp;#039;&amp;#039; &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;你不能在游戏中改变database schema。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Create your schema ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Create your schema ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Yeqing-</name></author>
	</entry>
	<entry>
		<id>https://zh-cn.doc.boardgamearena.com/index.php?title=Game_database_model:_dbmodel.sql&amp;diff=194&amp;oldid=prev</id>
		<title>Yeqing-：​创建页面，内容为“{{Studio_Framework_Navigation}}  In this file you specify the database schema of your game.  This file contains SQL queries that will be executed during the creation…”</title>
		<link rel="alternate" type="text/html" href="https://zh-cn.doc.boardgamearena.com/index.php?title=Game_database_model:_dbmodel.sql&amp;diff=194&amp;oldid=prev"/>
		<updated>2021-07-03T12:13:30Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“{{Studio_Framework_Navigation}}  In this file you specify the database schema of your game.  This file contains SQL queries that will be executed during the creation…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Studio_Framework_Navigation}}&lt;br /&gt;
&lt;br /&gt;
In this file you specify the database schema of your game.&lt;br /&gt;
&lt;br /&gt;
This file contains SQL queries that will be executed during the creation of your game table.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; you can&amp;#039;t change the database schema during the game.&lt;br /&gt;
&lt;br /&gt;
== Create your schema ==&lt;br /&gt;
&lt;br /&gt;
To build this file, we recommend you to build the tables you need with the PhpMyAdmin tool (see BGA user guide), and then to export them and to copy/paste the content inside this file.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; you must not use for a column the same name as for the table, as the framework replay function relies on regexp substitution to save/restore a previous state in a clone table with another name.&lt;br /&gt;
&lt;br /&gt;
Example: Deck component, see [[Deck]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CREATE TABLE IF NOT EXISTS `card` (&lt;br /&gt;
  `card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,&lt;br /&gt;
  `card_type` varchar(16) NOT NULL,&lt;br /&gt;
  `card_type_arg` int(11) NOT NULL,&lt;br /&gt;
  `card_location` varchar(16) NOT NULL,&lt;br /&gt;
  `card_location_arg` int(11) NOT NULL,&lt;br /&gt;
  PRIMARY KEY (`card_id`)&lt;br /&gt;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: Euro Game. See details on database design for euro game at [[BGA_Studio_Cookbook#Database_for_The_euro_game]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CREATE TABLE IF NOT EXISTS `token` (&lt;br /&gt;
  `token_key` varchar(32) NOT NULL,&lt;br /&gt;
  `token_location` varchar(32) NOT NULL,&lt;br /&gt;
  `token_state` int(10),&lt;br /&gt;
  PRIMARY KEY (`token_key`)&lt;br /&gt;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rules you should follow:&lt;br /&gt;
&lt;br /&gt;
* Do not overcomplicate, you dealing with games with 50-500 pieces!&lt;br /&gt;
** If you 5 tables for card game with 30 cards - it is overkill&lt;br /&gt;
* Database should only be storing dynamic data, all static data should be stored in material.php.inc&lt;br /&gt;
** Example: you have cards that have power, color, special abilities. In database you only need to store card type, all the other properties should not be there. Only exception - if it changes during the game.&lt;br /&gt;
* Columns should be permanent, independent of game data, i.e. location, type, position, row, etc&lt;br /&gt;
** Example: do not create columns like Counry1, Country2, Country3, ...&lt;br /&gt;
* Do not store translatable string in database, use integer number of &amp;quot;ident&amp;quot; to access properties&lt;br /&gt;
** I.e. card type should be &amp;quot;22&amp;quot; or &amp;quot;bob_cat&amp;quot;, instead of &amp;quot;Bob&amp;#039;s cat&amp;quot;&lt;br /&gt;
* Create separate module in php to handle all database queries, do a lot of type checking to prevent SQL injections&lt;br /&gt;
&lt;br /&gt;
Example of method handling database query:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    // Set token state&lt;br /&gt;
    function setTokenState($token_key, $state) {&lt;br /&gt;
        self::checkState($state); // ensure state is number&lt;br /&gt;
        self::checkKey($token_key); // ensure key is alphanum&lt;br /&gt;
        $sql = &amp;quot;UPDATE &amp;quot; . $this-&amp;gt;table;&lt;br /&gt;
        $sql .= &amp;quot; SET token_state=&amp;#039;$state&amp;#039;&amp;quot;;&lt;br /&gt;
        $sql .= &amp;quot; WHERE token_key=&amp;#039;$token_key&amp;#039;&amp;quot;; // don&amp;#039;t need to escape anymore since we checked key before&lt;br /&gt;
        self::DbQuery($sql);&lt;br /&gt;
        return $state;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Default tables ==&lt;br /&gt;
&lt;br /&gt;
Important: by default, BGA creates 4 tables for your game: &amp;#039;&amp;#039;&amp;#039;global&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;stats&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;gamelog&amp;#039;&amp;#039;&amp;#039;, and &amp;#039;&amp;#039;&amp;#039;player&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
You &amp;#039;must not modify&amp;#039; the schemas of the &amp;#039;&amp;#039;&amp;#039;global&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;stats&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;gamelog&amp;#039;&amp;#039;&amp;#039; tables (and you must not access them directly with SQL queries in your PHP code).&lt;br /&gt;
&lt;br /&gt;
=== The &amp;#039;&amp;#039;&amp;#039;player&amp;#039;&amp;#039;&amp;#039; table ===&lt;br /&gt;
&lt;br /&gt;
You may add columns to the &amp;#039;&amp;#039;&amp;#039;player&amp;#039;&amp;#039;&amp;#039; table. This is very practical to add simple values associated with players.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ALTER TABLE `player` ADD `player_reserve_size` SMALLINT UNSIGNED NOT NULL DEFAULT &amp;#039;7&amp;#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The commonly used columns of default &amp;quot;player&amp;quot; table are:&lt;br /&gt;
* &amp;lt;strong&amp;gt;player_no&amp;lt;/strong&amp;gt;: the index of player in natural playing order (starting with 1)&lt;br /&gt;
* &amp;lt;strong&amp;gt;player_id&amp;lt;/strong&amp;gt; (int)&lt;br /&gt;
* &amp;lt;strong&amp;gt;player_name&amp;lt;/strong&amp;gt;: (note: it is better to access this date with getActivePlayerName() or loadPlayersBasicInfos() methods)&lt;br /&gt;
* &amp;lt;strong&amp;gt;player_score&amp;lt;/strong&amp;gt;: the current score of the player (displayed in the player panel). You must update this field to update player&amp;#039;s scores.&lt;br /&gt;
* &amp;lt;strong&amp;gt;player_score_aux&amp;lt;/strong&amp;gt;: the secondary score, used as a tie breaker. You must update this field according to tie breaking rules of the game (see also: [[Main_game_logic:_yourgamename.game.php#Manage_player_scores_and_Tie_breaker|Manage_player_scores_and_Tie_breaker]])&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;player_table_order&amp;lt;/strong&amp;gt;: gives an indication of the rank of the player by order of arrival in the lobby (starting with 1). It is not the same as player_no (which is the player order &amp;lt;u&amp;gt;within&amp;lt;/u&amp;gt; the game). player_table_order is useful for setting custom teams if desired in a game option (for instance, 1st-2nd vs 3rd-4th).&amp;lt;br/&amp;gt;&amp;lt;strong&amp;gt;Note:&amp;lt;/strong&amp;gt; player_table_order &amp;#039;&amp;#039;only exists during game initialization&amp;#039;&amp;#039; (in the &amp;#039;&amp;#039;&amp;#039;setupNewGame&amp;#039;&amp;#039;&amp;#039; function). It is not added as a column in the &amp;#039;&amp;#039;&amp;#039;players&amp;#039;&amp;#039;&amp;#039; Db table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;&amp;lt;u&amp;gt;CAUTION:&amp;lt;/u&amp;gt;&amp;lt;/strong&amp;gt; &amp;#039;&amp;#039;&amp;#039;player_table_order&amp;#039;&amp;#039;&amp;#039; is not guaranteed to be equal to the rank of the player in the table. For example, in a 4-player game, if the table was full but the 3rd player leaves before the game starts, the 4th player becomes 3rd on this table &amp;lt;u&amp;gt;but&amp;lt;/u&amp;gt; their player_table_no is still equal to 4! If another player then joins, their player_table_no will then be 5...&amp;lt;br /&amp;gt;Thus, it is essential to normalize these values first in the game setup if you wish to use them to prevent bugs at game launch. For example, if the set of player_table_order are &amp;lt;player A&amp;gt;: 3, &amp;lt;player B&amp;gt;: 2, &amp;lt;player C&amp;gt;: 5, &amp;lt;player D&amp;gt;: 7, you see that you can&amp;#039;t read that values as ranks directly, but you can still deduce that &amp;lt;player B&amp;gt; was 1st on the table, then &amp;lt;player A&amp;gt; then &amp;lt;player C&amp;gt; then &amp;lt;player D&amp;gt;&amp;amp;nbsp;&amp;amp;#128521;&lt;br /&gt;
&lt;br /&gt;
See [https://en.doc.boardgamearena.com/BGA_Studio_Cookbook#Assigning_Player_Order Assigning Player Order] in the &amp;#039;&amp;#039;&amp;#039;BGA Studio Cookbook&amp;#039;&amp;#039;&amp;#039; for an example.&lt;br /&gt;
&lt;br /&gt;
== CREATE TABLES ==&lt;br /&gt;
you can create tables, using engine InnoDB&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CREATE TABLE IF NOT EXISTS `hands` &lt;br /&gt;
(&lt;br /&gt;
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, &lt;br /&gt;
`player_id` TINYINT(1) NOT NULL,&lt;br /&gt;
`1` BOOL NOT NULL DEFAULT 1,	&lt;br /&gt;
`2` BOOL NOT NULL DEFAULT 1,	&lt;br /&gt;
`3` BOOL NOT NULL DEFAULT 1,	&lt;br /&gt;
`4` BOOL NOT NULL DEFAULT 1,	&lt;br /&gt;
`5` BOOL NOT NULL DEFAULT 1,		&lt;br /&gt;
`6` BOOL NOT NULL DEFAULT 1,	&lt;br /&gt;
`7` BOOL NOT NULL DEFAULT 1,	&lt;br /&gt;
PRIMARY KEY (`id`)&lt;br /&gt;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note&amp;#039;&amp;#039;&amp;#039;: if you put comments, you cannot do it in the same line as code.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
`3` BOOL NOT NULL DEFAULT 1, --  activated or not&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will also comment out `3` BOOL, and that code will not be executed.&lt;br /&gt;
&lt;br /&gt;
== PHP ==&lt;br /&gt;
Database initialization should be in function setupNewGame() in &amp;#039;gamename.game.php&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
Database schema migration should be in function upgradeTableDb(), see below.&lt;br /&gt;
&lt;br /&gt;
Warning: all CREATE/ALTER tables and view should be in dbmodel.sql. Do not call this queries from php to avoid implicit commits https://dev.mysql.com/doc/refman/5.7/en/implicit-commit.html&lt;br /&gt;
which will cause issues. Only time you can do such queries from php is in upgradeTableDb method&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
== Errors Log ==&lt;br /&gt;
To trace Database creation check the logs that you can access in /admin/studio.&lt;br /&gt;
&lt;br /&gt;
== Post-release database modification ==&lt;br /&gt;
If you want to modify your database schema after the first release of your game in production, you should implement upgradeTableDb method, see [[Post-release phase#Updating the database schema|Updating the database schema after release]]&lt;/div&gt;</summary>
		<author><name>Yeqing-</name></author>
	</entry>
</feed>