| Conditions | 5 |
| Paths | 5 |
| Total Lines | 35 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function upgrade($oldVersion) |
||
| 26 | { |
||
| 27 | switch ($oldVersion) { |
||
| 28 | case '1.0.0': |
||
|
|
|||
| 29 | // routes of system modules are not stored in database anymore |
||
| 30 | $sql = ' |
||
| 31 | DELETE FROM `zikula_routes_route` |
||
| 32 | WHERE `userRoute` = 0 |
||
| 33 | '; |
||
| 34 | $this->entityManager->getConnection()->exec($sql); |
||
| 35 | |||
| 36 | // update table to meet entity structure |
||
| 37 | $this->schemaTool->update(['Zikula\RoutesModule\Entity\Historical\v110\RouteEntity']); |
||
| 38 | case '1.0.1': |
||
| 39 | // nothing |
||
| 40 | case '1.1.0': |
||
| 41 | // rename createdUserId field to createdBy_id |
||
| 42 | $sql = ' |
||
| 43 | ALTER TABLE `zikula_routes_route` |
||
| 44 | CHANGE `createdUserId` `createdBy_id` int(11) NOT NULL |
||
| 45 | '; |
||
| 46 | $this->entityManager->getConnection()->exec($sql); |
||
| 47 | |||
| 48 | // rename updatedUserId field to updatedBy_id |
||
| 49 | $sql = ' |
||
| 50 | ALTER TABLE `zikula_routes_route` |
||
| 51 | CHANGE `updatedUserId` `updatedBy_id` int(11) NOT NULL |
||
| 52 | '; |
||
| 53 | $this->entityManager->getConnection()->exec($sql); |
||
| 54 | case '1.1.1': |
||
| 55 | // current version |
||
| 56 | } |
||
| 57 | |||
| 58 | return true; |
||
| 59 | } |
||
| 60 | } |
||
| 61 |