| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | public function safeUp() |
||
| 20 | { |
||
| 21 | $this->createTable( |
||
| 22 | '{{%token}}', |
||
| 23 | [ |
||
| 24 | 'user_id' => $this->integer(), |
||
| 25 | 'code' => $this->string(32)->notNull(), |
||
| 26 | 'type' => $this->smallInteger(6)->notNull(), |
||
| 27 | 'created_at' => $this->integer()->notNull(), |
||
| 28 | ], |
||
| 29 | MigrationHelper::resolveTableOptions($this->db->driverName) |
||
| 30 | ); |
||
| 31 | |||
| 32 | $this->createIndex('idx_token_user_id_code_type', '{{%token}}', ['user_id', 'code', 'type'], true); |
||
| 33 | |||
| 34 | $restrict = MigrationHelper::isMicrosoftSQLServer($this->db->driverName) ? 'NO ACTION' : 'RESTRICT'; |
||
| 35 | |||
| 36 | $this->addForeignKey('fk_token_user', '{{%token}}', 'user_id', '{{%user}}', 'id', 'CASCADE', $restrict); |
||
| 37 | } |
||
| 38 | |||
| 44 |