Commit cddb71b4 by jomon

code review changes

parent 2b45d808
<?php
use yii\db\Migration;
use common\models\Category;
class m160830_105840_category extends Migration
{
/* public function up()
{
}
public function down()
{
echo "m160830_105840_category cannot be reverted.\n";
return false;
}*/
public function safeUp()
{
......@@ -30,8 +19,7 @@ class m160830_105840_category extends Migration
'description' => $this->string(512),
'image_url' => $this->string(1024),
'image_path' => $this->string(1024),
'status' => $this->smallInteger()->notNull(),
//->defaultValue(Category::STATUS_ACTIVE),
'status' => $this->smallInteger()->notNull()->defaultValue(Category::STATUS_ACTIVE),
'created_at' => $this->integer(),
'updated_at' => $this->integer()
], $tableOptions);
......@@ -40,13 +28,14 @@ class m160830_105840_category extends Migration
'id' => $this->primaryKey(),
'category_id' => $this->integer()->notNull(),
'code' => $this->string(32)->notNull(),
'type' => $this->string(32),
'name' => $this->string(32),
'type' => $this->string(32)->notNull(),
'name' => $this->string(32)->notNull(),
'created_at' => $this->integer(),
'updated_at' => $this->integer()
], $tableOptions);
$this->addForeignKey('fk_category', '{{%category_files}}', 'category_id', '{{%category}}', 'id', 'cascade', 'cascade');
$this->addForeignKey('fk_category', '{{%category_files}}', 'category_id', '{{%category}}', 'id', 'cascade',
'cascade');
}
public function safeDown()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment