| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function up() |
||
| 21 | { |
||
| 22 | $this->info( 'Migrating taxrate column in price table', 'vv' ); |
||
| 23 | |||
| 24 | $conn = $this->context()->db( 'db-price' ); |
||
|
|
|||
| 25 | |||
| 26 | $select = 'SELECT "id", "taxrate" FROM "mshop_price" WHERE "taxrate" NOT LIKE \'{%\''; |
||
| 27 | $update = 'UPDATE "mshop_price" SET "taxrate" = ? WHERE "id" = ?'; |
||
| 28 | |||
| 29 | $stmt = $conn->create( $update ); |
||
| 30 | $result = $conn->create( $select )->execute(); |
||
| 31 | |||
| 32 | while( ( $row = $result->fetch() ) !== null ) |
||
| 33 | { |
||
| 34 | $stmt->bind( 1, json_encode( ['' => $row['taxrate']], JSON_FORCE_OBJECT ) ); |
||
| 35 | $stmt->bind( 2, $row['id'], \Aimeos\Base\DB\Statement\Base::PARAM_INT ); |
||
| 36 | |||
| 37 | $stmt->execute()->finish(); |
||
| 38 | } |
||
| 41 |