Total Complexity | 3 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class m200725_141600_create_job_progress_table extends Migration |
||
8 | { |
||
9 | public $tableName = '{{%job_progress}}'; |
||
10 | |||
11 | public function up() |
||
12 | { |
||
13 | $tableOptions = null; |
||
14 | if ($this->db->driverName === 'mysql') { |
||
15 | // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci |
||
16 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
||
17 | } |
||
18 | |||
19 | $this->createTable($this->tableName, [ |
||
20 | 'id' => $this->primaryKey(), |
||
21 | 'job_id' => $this->integer()->notNull(), |
||
22 | 'progress_max' => $this->integer()->notNull(), |
||
23 | 'progress_now' => $this->integer()->notNull(), |
||
24 | ], $tableOptions); |
||
25 | |||
26 | $this->createIndex('job_id', $this->tableName, 'job_id'); |
||
27 | } |
||
28 | |||
29 | public function down() |
||
30 | { |
||
31 | $this->dropTable($this->tableName); |
||
32 | } |
||
34 |