Commit cddb71b4 by jomon

code review changes

parent 2b45d808
<?php <?php
use yii\db\Migration; use yii\db\Migration;
use common\models\Category;
class m160830_105840_category extends Migration 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() public function safeUp()
{ {
...@@ -29,9 +18,8 @@ class m160830_105840_category extends Migration ...@@ -29,9 +18,8 @@ class m160830_105840_category extends Migration
'slug' => $this->string(32)->notNull(), 'slug' => $this->string(32)->notNull(),
'description' => $this->string(512), 'description' => $this->string(512),
'image_url' => $this->string(1024), 'image_url' => $this->string(1024),
'image_path' => $this->string(1024), 'image_path' => $this->string(1024),
'status' => $this->smallInteger()->notNull(), 'status' => $this->smallInteger()->notNull()->defaultValue(Category::STATUS_ACTIVE),
//->defaultValue(Category::STATUS_ACTIVE),
'created_at' => $this->integer(), 'created_at' => $this->integer(),
'updated_at' => $this->integer() 'updated_at' => $this->integer()
], $tableOptions); ], $tableOptions);
...@@ -40,13 +28,14 @@ class m160830_105840_category extends Migration ...@@ -40,13 +28,14 @@ class m160830_105840_category extends Migration
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'category_id' => $this->integer()->notNull(), 'category_id' => $this->integer()->notNull(),
'code' => $this->string(32)->notNull(), 'code' => $this->string(32)->notNull(),
'type' => $this->string(32), 'type' => $this->string(32)->notNull(),
'name' => $this->string(32), 'name' => $this->string(32)->notNull(),
'created_at' => $this->integer(), 'created_at' => $this->integer(),
'updated_at' => $this->integer() 'updated_at' => $this->integer()
], $tableOptions); ], $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() 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