for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use yii\db\Migration;
/**
* Class m150828_085134_init_user_tables
*/
class m150828_085134_init_user_tables extends Migration
{
public function up()
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
// Create user table
$this->createTable('{{%User}}', [
'id' => $this->primaryKey(),
'username' => $this->string()->notNull()->unique(),
'authKey' => $this->string(32)->notNull(),
'passwordHash' => $this->string()->notNull(),
'passwordResetToken' => $this->string()->unique(),
'email' => $this->string()->notNull()->unique(),
'status' => $this->smallInteger()->notNull()->defaultValue(1),
'createdAt' => $this->integer()->notNull(),
'updatedAt' => $this->integer()->notNull(),
'lastLogin' => $this->integer(),
], $tableOptions);
public function down()
$this->dropTable('{{%User}}');
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
public function safeDown()