| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | $tableOptions = null; |
||
| 17 | if ($this->db->driverName === 'mysql') { |
||
| 18 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
||
| 19 | } |
||
| 20 | |||
| 21 | $this->createTable('user', [ |
||
| 22 | 'username' => $this->string(64)->notNull(), |
||
| 23 | 'hash' => $this->string(64), |
||
| 24 | 'authkey' => $this->string(64)->notNull(), |
||
| 25 | 'access_token' => $this->string(64)->notNull(), |
||
| 26 | 'added_at' => $this->timestamp()->notNull()->defaultExpression('CURRENT_TIMESTAMP'), |
||
| 27 | 'last_login_at' => $this->timestamp()->null(), |
||
| 28 | ], $tableOptions); |
||
| 29 | |||
| 30 | $this->addPrimaryKey( |
||
| 31 | 'pk_user', |
||
| 32 | 'user', |
||
| 33 | ['username'] |
||
| 34 | ); |
||
| 35 | |||
| 36 | \app\models\User::create('admin', 'admin'); |
||
| 37 | } |
||
| 38 | |||
| 47 |