|
|
|
<?php
|
|
|
|
|
|
|
|
use yii\db\Migration;
|
|
|
|
|
|
|
|
class m130524_201442_init extends Migration
|
|
|
|
{
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
$tableOptions = null;
|
|
|
|
if ($this->db->driverName === 'mysql') {
|
|
|
|
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
|
|
|
|
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->createTable('{{%users}}', [
|
|
|
|
'id' => $this->bigPrimaryKey(),
|
|
|
|
'username' => $this->string(),
|
|
|
|
'auth_key' => $this->string(32)->notNull(),
|
|
|
|
'password_hash' => $this->string(),
|
|
|
|
'password_reset_token' => $this->string()->unique(),
|
|
|
|
'email' => $this->string(),
|
|
|
|
'email_confirm_token' => $this->string()->unique(),
|
|
|
|
'user_pic' => $this->string(255)->null(),
|
|
|
|
'settings' => $this->text(),
|
|
|
|
'backend_language' => $this->string(10),
|
|
|
|
'frontend_language' => $this->string(10),
|
|
|
|
'status' => $this->smallInteger()->notNull()->defaultValue(10),
|
|
|
|
'created_at' => $this->integer()->notNull(),
|
|
|
|
'updated_at' => $this->integer()->notNull(),
|
|
|
|
], $tableOptions);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
$this->dropTable('{{%user}}');
|
|
|
|
}
|
|
|
|
}
|