Conditions | 1 |
Paths | 1 |
Total Lines | 29 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | public function safeUp() |
||
11 | { |
||
12 | $this->createTable('{{%articles}}', [ |
||
13 | 'id' => $this->primaryKey(), |
||
14 | 'title' => $this->string()->notNull(), |
||
15 | 'content' => $this->text(), |
||
16 | 'category_id' => $this->integer()->notNull(), |
||
17 | ]); |
||
18 | |||
19 | $this->createTable('{{%article_categories}}', [ |
||
20 | 'id' => $this->primaryKey(), |
||
21 | 'name' => $this->string()->notNull(), |
||
22 | ]); |
||
23 | |||
24 | $this->insert('{{%article_categories}}', [ |
||
25 | 'id' => 1, |
||
26 | 'name' => 'Category1' |
||
27 | ]); |
||
28 | $this->insert('{{%article_categories}}', [ |
||
29 | 'id' => 2, |
||
30 | 'name' => 'Category2' |
||
31 | ]); |
||
32 | $this->insert('{{%articles}}', [ |
||
33 | 'category_id' => 1, |
||
34 | 'title' => 'Article1' |
||
35 | ]); |
||
36 | $this->insert('{{%articles}}', [ |
||
37 | 'category_id' => 1, |
||
38 | 'title' => 'Article2' |
||
39 | ]); |
||
51 |