| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function up() |
||
| 14 | { |
||
| 15 | $tableOptions = null; |
||
| 16 | if ($this->db->driverName === 'mysql') { |
||
| 17 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; |
||
| 18 | } |
||
| 19 | $this->createTable('{{%post}}', [ |
||
| 20 | 'id' => $this->primaryKey(), |
||
| 21 | 'title' => $this->string()->notNull()->comment('标题'), |
||
| 22 | 'img' => $this->string()->comment('图片'), |
||
| 23 | 'views' => $this->integer()->comment('访问量'), |
||
| 24 | 'order' => $this->smallInteger()->comment('序号'), |
||
| 25 | 'status' => $this->boolean()->defaultValue(1)->comment('状态'), |
||
| 26 | 'content' => $this->text()->comment('内容'), |
||
| 27 | 'created_at' => $this->integer()->comment('创建时间'), |
||
| 28 | 'updated_at' => $this->integer()->comment('更新时间'), |
||
| 29 | ], $tableOptions); |
||
| 30 | } |
||
| 31 | |||
| 40 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.