-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3634 from MTES-MCT/feature/3426-update-missing-fi…
…eld-json [BO] Données de type doctrine ne se mettrait pas à jour
- Loading branch information
Showing
4 changed files
with
92 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20250127183041 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Update JSON fields with signalement column value.'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql(" | ||
UPDATE `signalement` | ||
SET type_composition_logement = JSON_SET(type_composition_logement, '$.type_logement_nature', nature_logement) | ||
WHERE JSON_VALID(type_composition_logement) AND nature_logement IS NOT NULL; | ||
"); | ||
|
||
$this->addSql(" | ||
UPDATE `signalement` | ||
SET situation_foyer = JSON_SET(situation_foyer, '$.logement_social_date_naissance', DATE(date_naissance_occupant)) | ||
WHERE JSON_VALID(situation_foyer) AND date_naissance_occupant IS NOT NULL;"); | ||
|
||
$this->addSql(" | ||
UPDATE `signalement` | ||
SET situation_foyer = JSON_SET(situation_foyer, '$.logement_social_numero_allocataire', num_allocataire) | ||
WHERE JSON_VALID(situation_foyer) AND num_allocataire IS NOT NULL;"); | ||
|
||
$this->addSql(" | ||
UPDATE `signalement` | ||
SET information_complementaire = JSON_SET(information_complementaire, '$.informations_complementaires_logement_montant_loyer', loyer) | ||
WHERE JSON_VALID(information_complementaire) AND loyer IS NOT NULL;"); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters