| Total Complexity | 2 | 
| Total Lines | 77 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 8 | class m180509_092225_create_articles_table extends MultilanguageMigration | ||
| 9 | { | ||
| 10 | /** | ||
| 11 |      * {@inheritdoc} | ||
| 12 | */ | ||
| 13 | public function safeUp() | ||
| 14 |     { | ||
| 15 |         $this->createMultiLanguageTable('articles', | ||
| 16 | [ | ||
| 17 | 'title' => $this->string(128)->notNull(), | ||
| 18 | 'description' => $this->text(), | ||
| 19 | 'content' => $this->text(), | ||
| 20 | 'metaKeys' => $this->string(128), | ||
| 21 | 'metaDescription' => $this->string(), | ||
| 22 | ], | ||
| 23 | [ | ||
| 24 | 'pageId' => $this->integer(), | ||
| 25 | 'active' => $this->tinyInteger()->notNull()->defaultValue(0), | ||
| 26 | 'icon' => $this->string(128), | ||
| 27 | 'alias' => $this->string(128), | ||
| 28 | ] | ||
| 29 | ); | ||
| 30 | |||
| 31 | $this->createIndex( | ||
| 32 | 'idx-articles-pageId', | ||
| 33 | 'articles', | ||
| 34 | 'pageId' | ||
| 35 | ); | ||
| 36 | |||
| 37 | $this->addForeignKey( | ||
| 38 | 'fk-articles-pageId', | ||
| 39 | 'articles', | ||
| 40 | 'pageId', | ||
| 41 | 'pages', | ||
| 42 | 'id', | ||
| 43 | 'SET NULL' | ||
| 44 | ); | ||
| 45 | |||
| 46 | $this->createIndex( | ||
| 47 | 'idx-articles-active', | ||
| 48 | 'articles', | ||
| 49 | 'active' | ||
| 50 | ); | ||
| 51 | |||
| 52 | $this->createIndex( | ||
| 53 | 'idx-articles-alias', | ||
| 54 | 'articles', | ||
| 55 | 'alias' | ||
| 56 | ); | ||
| 57 | } | ||
| 58 | |||
| 59 | /** | ||
| 60 |      * {@inheritdoc} | ||
| 61 | */ | ||
| 62 | public function safeDown() | ||
| 85 | } | ||
| 86 | } | ||
| 87 |