for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%category}}`.
*/
class m200730_065801_create_category_table extends Migration
{
* {@inheritdoc}
public function safeUp()
$this->createTable('{{%category}}', [
'id' => $this->primaryKey(),
'user_id' => $this->integer()->notNull(),
'direction' => $this->tinyInteger()->notNull(),
'name' => $this->string(120)->notNull(),
'color' => $this->string(7)->notNull(),
'icon_name' => $this->string(120)->notNull(),
'status' => $this->tinyInteger()->defaultValue(1),
'created_at' => $this->timestamp()->defaultValue(null),
'updated_at' => $this->timestamp()->defaultValue(null),
]);
$this->createIndex('category_user_id', '{{%category}}', 'user_id');
}
public function safeDown()
$this->dropTable('{{%category}}');