Release 2.5.0 Upgrade Note

From BOARD18 Project WIKI
Jump to: navigation, search

Before upgrading to release 2.5.x from any release prior to 2.5.0, two changes must be made to the BOARD18 database.
First the new `auth_tokens` table must be added to the database. And second the `email` field in the `players`
table must be expanded to comply with RFC 3696.
Neither of these database changes will cause any data loss in the existing database.

Use the following code to make these changes:

mysql -h name.of.host -u username -p << END
USE database-name
DROP TABLE IF EXISTS auth_tokens;
CREATE TABLE auth_tokens (
  token_id int(11) unsigned NOT NULL AUTO_INCREMENT,
  selector varchar(16) NOT NULL,
  hashedValidator char(64) DEFAULT NULL,
  player_id int(11) unsigned NOT NULL,
  expires bigint(20) NOT NULL,
  PRIMARY KEY (token_id),
  UNIQUE KEY playtok (player_id,token_id),
  UNIQUE KEY seltok (selector,token_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE players MODIFY email VARCHAR(254) NOT NULL;
END

Replace 'name.of.host', 'username' and 'database-name' with appropriate values.

After the change has been made the effected tables should look like this:

mysql> show columns from auth_tokens;
+-----------------+------------------+------+-----+---------+----------------+
| Field           | Type             | Null | Key | Default | Extra          |
+-----------------+------------------+------+-----+---------+----------------+
| token_id        | int(11) unsigned | NO   | PRI | NULL    | auto_increment |
| selector        | varchar(16)      | NO   | MUL | NULL    |                |
| hashedValidator | char(64)         | YES  |     | NULL    |                |
| player_id       | int(11) unsigned | NO   | MUL | NULL    |                |
| expires         | bigint(20)       | NO   |     | NULL    |                |
+-----------------+------------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)

mysql> show columns from players;
+-------------+---------------------+------+-----+-------------------+----------------+
| Field       | Type                | Null | Key | Default           | Extra          |
+-------------+---------------------+------+-----+-------------------+----------------+
| player_id   | int(11) unsigned    | NO   | PRI | NULL              | auto_increment |
| firstname   | varchar(25)         | YES  |     | NULL              |                |
| lastname    | varchar(25)         | YES  |     | NULL              |                |
| email       | varchar(254)        | NO   | UNI | NULL              |                |
| login       | varchar(16)         | NO   | UNI | NULL              |                |
| passwd      | varchar(64)         | NO   |     | NULL              |                |
| create-date | timestamp           | NO   |     | CURRENT_TIMESTAMP |                |
| level       | varchar(10)         | NO   |     | player            |                |
| changeit    | tinyint(1) unsigned | NO   |     | 0                 |                |
+-------------+---------------------+------+-----+-------------------+----------------+
9 rows in set (0.00 sec)