Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
6 | public function safeUp() |
||
7 | { |
||
8 | $tableOptions = null; |
||
9 | if ($this->db->driverName === 'mysql') { |
||
10 | // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci |
||
11 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
||
12 | } |
||
13 | |||
14 | $this->createTable('{{%comment}}', [ |
||
15 | 'id' => $this->primaryKey(), |
||
16 | 'entity' => $this->string(), |
||
17 | 'text' => $this->text(), |
||
18 | 'deleted' => $this->boolean()->notNull()->defaultValue(false), |
||
19 | 'created_by' => $this->integer(), |
||
20 | 'updated_by' => $this->integer(), |
||
21 | 'created_at' => $this->integer(), |
||
22 | 'updated_at' => $this->integer(), |
||
23 | ], $tableOptions); |
||
24 | |||
25 | $this->createIndex('idx_entity', '{{%comment}}', ['entity']); |
||
26 | $this->createIndex('idx_created_by', '{{%comment}}', ['created_by']); |
||
27 | $this->createIndex('idx_created_at', '{{%comment}}', ['created_at']); |
||
28 | } |
||
29 | |||
35 |
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.