-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathm150227_114524_init.php
40 lines (35 loc) · 1.09 KB
/
m150227_114524_init.php
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
<?php
use yii\db\Migration;
/**
* Class m150227_114524_init
*/
class m150227_114524_init extends Migration
{
/**
* This method contains the logic to be executed when applying this migration.
*/
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%Setting}}', [
'id' => $this->primaryKey(),
'type' => $this->string(10)->notNull(),
'section' => $this->string()->notNull(),
'key' => $this->string()->notNull(),
'value' => $this->text()->notNull(),
'status' => $this->smallInteger()->notNull()->defaultValue(1),
'createdAt' => $this->integer()->notNull(),
'updatedAt' => $this->integer()->notNull(),
], $tableOptions);
}
/**
* This method contains the logic to be executed when removing this migration.
*/
public function down()
{
$this->dropTable('{{%Setting}}');
}
}