m130524_201442_init.php 884 Bytes
Newer Older
1 2
<?php

Suralc committed
3 4
use yii\db\Schema;

5 6 7 8 9 10 11 12 13 14
class m130524_201442_init extends \yii\db\Migration
{
	public function up()
	{
		// MySQL-specific table options. Adjust if you plan working with another DBMS
		$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';

		$this->createTable('tbl_user', array(
			'id' => Schema::TYPE_PK,
			'username' => Schema::TYPE_STRING.' NOT NULL',
15
			'auth_key' => Schema::TYPE_STRING.'(32) NOT NULL',
16
			'password_hash' => Schema::TYPE_STRING.' NOT NULL',
17
			'password_reset_token' => Schema::TYPE_STRING.'(32)',
18 19 20 21 22 23 24 25 26 27 28 29 30 31
			'email' => Schema::TYPE_STRING.' NOT NULL',
			'role' => 'tinyint NOT NULL DEFAULT 10',

			'status' => 'tinyint NOT NULL DEFAULT 10',
			'create_time' => Schema::TYPE_INTEGER.' NOT NULL',
			'update_time' => Schema::TYPE_INTEGER.' NOT NULL',
		), $tableOptions);
	}

	public function down()
	{
		$this->dropTable('tbl_user');
	}
}