m171112_193657_create_table_region.php
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
use yii\db\Migration;
use thread\modules\location\Location as ParentModule;
class m171112_193657_create_table_region extends Migration
{
/**
*
*/
public function init()
{
$this->db = ParentModule::getDb();
parent::init();
}
protected $table = '{{%location_region}}';
/**
* @inheritdoc
*/
public function safeUp()
{
$this->createTable($this->table, [
'id' => $this->primaryKey()->unsigned()->comment('Id'),
'position' => $this->integer(10)->notNull()->defaultValue(0)->comment('position'),
'created_at' => $this->integer(10)->notNull()->defaultValue(0)->comment('Create time'),
'updated_at' => $this->integer(10)->notNull()->defaultValue(0)->comment('Update time'),
'published' => $this->boolean()->notNull()->defaultValue(0)->comment('Published'),
'deleted' => $this->boolean()->notNull()->defaultValue(0)->comment('Deleted'),
]);
}
/**
* @inheritdoc
*/
public function safeDown()
{
$this->dropTable($this->table);
}
}