Total Complexity | 3 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class m000000_000001_create_user_table extends Migration |
||
9 | { |
||
10 | /** |
||
11 | * {@inheritdoc} |
||
12 | */ |
||
13 | public function up() |
||
14 | { |
||
15 | $tableOptions = null; |
||
16 | |||
17 | if ($this->db->driverName === 'mysql') { |
||
18 | // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci |
||
19 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
||
20 | } |
||
21 | |||
22 | $this->createTable('{{%user}}', [ |
||
23 | 'id' =>$this->primaryKey(), |
||
24 | 'username' =>$this->string()->notNull()->unique(), |
||
25 | 'auth_key' =>$this->string(32)->notNull(), |
||
26 | 'password_hash' =>$this->string()->notNull(), |
||
27 | 'password_reset_token' =>$this->string()->unique(), |
||
28 | 'email' =>$this->string()->notNull()->unique(), |
||
29 | 'role' =>$this->smallInteger()->notNull()->defaultValue(10), |
||
30 | 'status' =>$this->smallInteger()->notNull()->defaultValue(10), |
||
31 | 'created_at' =>$this->integer()->notNull(), |
||
32 | 'updated_at' =>$this->integer()->notNull(), |
||
33 | ], $tableOptions); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public function down() |
||
42 | } |
||
43 | } |
||
44 |