Conditions | 3 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | public function up() |
||
40 | { |
||
41 | $this->addColumn( |
||
42 | $this->env->workerTableName, |
||
43 | 'pinged_at', |
||
44 | $this->integer()->notNull()->after('started_at') |
||
45 | ); |
||
46 | |||
47 | $query = (new Query())->from($this->env->workerTableName); |
||
48 | foreach ($query->all() as $row) { |
||
49 | $this->update( |
||
50 | $this->env->workerTableName, |
||
51 | ['pinged_at' => $row['finished_at'] ?: time()], |
||
52 | ['id' => $row['id']] |
||
53 | ); |
||
54 | } |
||
55 | |||
56 | $this->addColumn( |
||
57 | $this->env->workerTableName, |
||
58 | 'stopped_at', |
||
59 | $this->integer()->after('pinged_at') |
||
60 | ); |
||
72 |