Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
7 | public function safeUp() |
||
8 | { |
||
9 | $tableOptions = null; |
||
10 | if ($this->db->driverName === 'mysql') { |
||
11 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; |
||
12 | } |
||
13 | |||
14 | $this->createTable('{{%news_files}}', [ |
||
15 | 'id' => Schema::TYPE_PK, |
||
16 | 'news_id' => Schema::TYPE_INTEGER . " NOT NULL DEFAULT 0", |
||
17 | 'file_id' => Schema::TYPE_INTEGER . " NOT NULL DEFAULT 0", |
||
18 | 'type' => Schema::TYPE_INTEGER . " NOT NULL DEFAULT 0", |
||
19 | 'position' => Schema::TYPE_INTEGER . " NOT NULL DEFAULT 0", |
||
20 | ], $tableOptions); |
||
21 | |||
22 | $this->createIndex('link', '{{%news_files}}', 'news_id, file_id'); |
||
23 | $this->createIndex('type_news', '{{%news_files}}', 'type, news_id'); |
||
24 | } |
||
25 | |||
31 |