Total Complexity | 3 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class m130524_201442_init extends \yii\db\Migration |
||
6 | { |
||
7 | public function up() |
||
8 | { |
||
9 | $tableOptions = null; |
||
10 | if ($this->db->driverName === 'mysql') { |
||
11 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; |
||
12 | } |
||
13 | |||
14 | $this->createTable('{{%user}}', [ |
||
15 | 'id' => Schema::TYPE_PK, |
||
16 | 'username' => Schema::TYPE_STRING . ' NOT NULL', |
||
17 | 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', |
||
18 | 'password_hash' => Schema::TYPE_STRING . ' NOT NULL', |
||
19 | 'password_reset_token' => Schema::TYPE_STRING, |
||
20 | 'email' => Schema::TYPE_STRING . ' NOT NULL', |
||
21 | 'role' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', |
||
22 | |||
23 | 'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', |
||
24 | 'created_at' => Schema::TYPE_INTEGER . ' NOT NULL', |
||
25 | 'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL', |
||
26 | ], $tableOptions); |
||
27 | } |
||
28 | |||
29 | public function down() |
||
32 | } |
||
33 | } |
||
34 |