Conditions | 3 |
Paths | 2 |
Total Lines | 25 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function safeUp() |
||
24 | { |
||
25 | $this->addColumn( |
||
26 | $this->env->workerTableName, |
||
27 | 'pinged_at', |
||
28 | $this->integer()->notNull()->after('started_at') |
||
29 | ); |
||
30 | |||
31 | $time = $this->beginCommand("update {$this->env->workerTableName}"); |
||
32 | $this->compact = true; |
||
33 | $query = (new Query())->from($this->env->workerTableName); |
||
34 | foreach ($query->all($this->db) as $row) { |
||
35 | $this->update( |
||
36 | $this->env->workerTableName, |
||
37 | ['pinged_at' => $row['finished_at'] ?: time()], |
||
38 | ['id' => $row['id']] |
||
39 | ); |
||
40 | } |
||
41 | $this->compact = false; |
||
42 | $this->endCommand($time); |
||
43 | |||
44 | $this->addColumn( |
||
45 | $this->env->workerTableName, |
||
46 | 'stopped_at', |
||
47 | $this->integer()->after('pinged_at') |
||
48 | ); |
||
60 |