| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 18 | 
| Code Lines | 13 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 44 | public function down(Schema $schema) | ||
| 45 |     { | ||
| 46 | $platform = $this->connection->getDatabasePlatform()->getName(); | ||
| 47 |         $cipherService = $this->container->get('ds_encryption.service.cipher'); | ||
| 48 | |||
| 49 |         switch ($platform) { | ||
| 50 | case 'postgresql': | ||
| 51 | // Schema | ||
| 52 | $this->warnIf(true, 'Tenant data column was lost during the previous migration and was reset to an empty object.'); | ||
| 53 |                 $this->addSql('ALTER TABLE ds_tenant ADD data JSON NULL'); | ||
| 54 | $data = '"'.$cipherService->encrypt(serialize(new stdClass)).'"'; | ||
| 55 |                 $this->addSql('UPDATE ds_tenant SET data = '.$this->connection->quote($data)); | ||
| 56 |                 $this->addSql('ALTER TABLE ds_tenant ALTER COLUMN data SET NOT NULL'); | ||
| 57 | break; | ||
| 58 | |||
| 59 | default: | ||
| 60 | $this->abortIf(true,'Migration cannot be executed on "'.$platform.'".'); | ||
| 61 | break; | ||
| 62 | } | ||
| 65 |