| Conditions | 2 |
| Paths | 2 |
| Total Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | $tableOptions = null; |
||
| 17 | if ($this->db->driverName === 'mysql') { |
||
| 18 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
||
| 19 | } |
||
| 20 | |||
| 21 | $this->createTable('screen', [ |
||
| 22 | 'id' => $this->primaryKey()->notNull()->append('AUTO_INCREMENT'), |
||
| 23 | 'name' => $this->string(64)->notNull(), |
||
| 24 | 'description' => $this->string(1024), |
||
| 25 | 'template_id' => $this->integer()->notNull(), |
||
| 26 | 'duration' => $this->integer()->notNull()->defaultValue(60), |
||
| 27 | 'last_changes' => $this->timestamp()->notNull()->defaultExpression('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), |
||
| 28 | ], $tableOptions); |
||
| 29 | |||
| 30 | $this->createIndex( |
||
| 31 | 'fk_screen_template1_idx', |
||
| 32 | 'screen', |
||
| 33 | 'template_id' |
||
| 34 | ); |
||
| 35 | |||
| 36 | $this->addForeignKey( |
||
| 37 | 'fk_screen_template1', |
||
| 38 | 'screen', |
||
| 39 | 'template_id', |
||
| 40 | 'screen_template', |
||
| 41 | 'id', |
||
| 42 | 'CASCADE', |
||
| 43 | 'CASCADE' |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 55 |