From f2eaf23c2a79c134c50e6817bd8facfcab43bae9 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 19 Sep 2024 14:37:05 +0200 Subject: [PATCH 01/16] Clean migration for activity bundle --- .../Entity/ActivityReason.php | 4 +-- .../Entity/ActivityReasonCategory.php | 8 ++--- .../migrations/Version20240918142723.php | 34 +++++++++++++++++++ 3 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 src/Bundle/ChillActivityBundle/migrations/Version20240918142723.php diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php index bf36ead6c..f6bdac24e 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReason.php @@ -32,8 +32,8 @@ class ActivityReason #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] - private array $name; + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '{}', 'jsonb' => true])] + private array $name = []; /** * Get active. diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php index b31bb8731..3555cd8fc 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php @@ -31,11 +31,9 @@ class ActivityReasonCategory implements \Stringable #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - /** - * @var string - */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] - private $name; + + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '{}', 'jsonb' => true])] + private array $name = []; /** * Array of ActivityReason. diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20240918142723.php b/src/Bundle/ChillActivityBundle/migrations/Version20240918142723.php new file mode 100644 index 000000000..d453a9bbc --- /dev/null +++ b/src/Bundle/ChillActivityBundle/migrations/Version20240918142723.php @@ -0,0 +1,34 @@ +addSql('ALTER TABLE activity ALTER privatecomment_comments SET NOT NULL'); + $this->addSql('ALTER TABLE activityreason ALTER name SET DEFAULT \'{}\''); + $this->addSql('ALTER TABLE activityreason ALTER name SET NOT NULL'); + $this->addSql('ALTER INDEX idx_654a2fcd12469de2 RENAME TO IDX_AF82522312469DE2'); + $this->addSql('ALTER TABLE activityreasoncategory ALTER name SET DEFAULT \'{}\''); + $this->addSql('ALTER TABLE activityreasoncategory ALTER name SET NOT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE activityreason ALTER name DROP DEFAULT'); + $this->addSql('ALTER TABLE activityreason ALTER name DROP NOT NULL'); + $this->addSql('ALTER TABLE activityreasoncategory ALTER name DROP DEFAULT'); + $this->addSql('ALTER TABLE activityreasoncategory ALTER name DROP NOT NULL'); + } +} From de711181dfcf7e77dfcdadb3796e24c8bae19d11 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 19 Sep 2024 14:37:31 +0200 Subject: [PATCH 02/16] Clean migration for budget bundle --- .../ChillBudgetBundle/Entity/ChargeKind.php | 4 +-- .../ChillBudgetBundle/Entity/ResourceKind.php | 4 +-- .../migrations/Version20240918143139.php | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php diff --git a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php index dd63399e9..d5a58c68c 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php @@ -37,13 +37,13 @@ class ChargeKind #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, options: ['default' => ''], nullable: false)] private string $kind = ''; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '{}', 'jsonb' => true])] private array $name = []; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])] private float $ordering = 0.00; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '{}', 'jsonb' => true])] private array $tags = []; public function getId(): ?int diff --git a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php index ec867a480..603b7d6a4 100644 --- a/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php +++ b/src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php @@ -39,13 +39,13 @@ class ResourceKind #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: false, options: ['default' => ''])] private string $kind = ''; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '{}', 'jsonb' => true])] private array $name = []; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => '0.00'])] private float $ordering = 0.00; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '[]'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, length: 255, options: ['default' => '{}', 'jsonb' => true])] private array $tags = []; public function getId(): ?int diff --git a/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php b/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php new file mode 100644 index 000000000..ace30aaac --- /dev/null +++ b/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php @@ -0,0 +1,28 @@ +addSql('ALTER TABLE chill_budget.charge DROP familymember_id'); + $this->addSql('ALTER TABLE chill_budget.resource DROP familymember_id'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_budget.resource ADD familymember_id INT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_budget.charge ADD familymember_id INT DEFAULT NULL'); + } +} From 82cb359072023ac41b734efbb517a49bebb00637 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 19 Sep 2024 14:37:57 +0200 Subject: [PATCH 03/16] Clean migration for main bundle --- src/Bundle/ChillMainBundle/Entity/Center.php | 2 +- src/Bundle/ChillMainBundle/Entity/Country.php | 2 +- .../Entity/CronJobExecution.php | 2 +- .../Entity/DashboardConfigItem.php | 2 +- .../ChillMainBundle/Entity/Location.php | 2 +- .../ChillMainBundle/Entity/LocationType.php | 4 +-- .../ChillMainBundle/Entity/Notification.php | 2 +- .../Entity/PermissionsGroup.php | 2 +- src/Bundle/ChillMainBundle/Entity/User.php | 2 +- .../migrations/Version20240918150339.php | 32 +++++++++++++++++++ 10 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20240918150339.php diff --git a/src/Bundle/ChillMainBundle/Entity/Center.php b/src/Bundle/ChillMainBundle/Entity/Center.php index 0d0858a6e..1ac7f5977 100644 --- a/src/Bundle/ChillMainBundle/Entity/Center.php +++ b/src/Bundle/ChillMainBundle/Entity/Center.php @@ -36,7 +36,7 @@ class Center implements HasCenterInterface, \Stringable #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] private string $name = ''; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])] private bool $isActive = true; /** diff --git a/src/Bundle/ChillMainBundle/Entity/Country.php b/src/Bundle/ChillMainBundle/Entity/Country.php index 533caeaec..c5433d46c 100644 --- a/src/Bundle/ChillMainBundle/Entity/Country.php +++ b/src/Bundle/ChillMainBundle/Entity/Country.php @@ -39,7 +39,7 @@ class Country * @var array */ #[Groups(['read', 'docgen:read'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])] #[Context(['is-translatable' => true], groups: ['docgen:read'])] private array $name = []; diff --git a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php index f2f1194c8..dd3c5da58 100644 --- a/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php +++ b/src/Bundle/ChillMainBundle/Entity/CronJobExecution.php @@ -30,7 +30,7 @@ class CronJobExecution #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])] private ?int $lastStatus = null; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => "'{}'::jsonb", 'jsonb' => true])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '{}', 'jsonb' => true])] private array $lastExecutionData = []; public function __construct( diff --git a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php index 6fdd34cfc..d94e93742 100644 --- a/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php +++ b/src/Bundle/ChillMainBundle/Entity/DashboardConfigItem.php @@ -39,7 +39,7 @@ class DashboardConfigItem private ?User $user = null; #[Serializer\Groups(['dashboardConfigItem:read'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '{}', 'jsonb' => true])] private array $metadata = []; public function getId(): ?int diff --git a/src/Bundle/ChillMainBundle/Entity/Location.php b/src/Bundle/ChillMainBundle/Entity/Location.php index 228fd089f..5705e6a1a 100644 --- a/src/Bundle/ChillMainBundle/Entity/Location.php +++ b/src/Bundle/ChillMainBundle/Entity/Location.php @@ -26,7 +26,7 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap; class Location implements TrackCreationInterface, TrackUpdateInterface { #[Serializer\Groups(['read'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])] private bool $active = true; #[Serializer\Groups(['read', 'write', 'docgen:read'])] diff --git a/src/Bundle/ChillMainBundle/Entity/LocationType.php b/src/Bundle/ChillMainBundle/Entity/LocationType.php index df212646a..16bca82e9 100644 --- a/src/Bundle/ChillMainBundle/Entity/LocationType.php +++ b/src/Bundle/ChillMainBundle/Entity/LocationType.php @@ -34,7 +34,7 @@ class LocationType final public const STATUS_REQUIRED = 'required'; #[Serializer\Groups(['read'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])] private bool $active = true; #[Serializer\Groups(['read'])] @@ -54,7 +54,7 @@ class LocationType private ?string $defaultFor = null; #[Serializer\Groups(['read'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])] private bool $editableByUsers = true; #[Serializer\Groups(['read', 'docgen:read'])] diff --git a/src/Bundle/ChillMainBundle/Entity/Notification.php b/src/Bundle/ChillMainBundle/Entity/Notification.php index d85a144b0..9f08e0487 100644 --- a/src/Bundle/ChillMainBundle/Entity/Notification.php +++ b/src/Bundle/ChillMainBundle/Entity/Notification.php @@ -41,7 +41,7 @@ class Notification implements TrackUpdateInterface * * @var array|string[] */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])] private array $addressesEmails = []; /** diff --git a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php index 4902fca95..723513c8b 100644 --- a/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php +++ b/src/Bundle/ChillMainBundle/Entity/PermissionsGroup.php @@ -24,7 +24,7 @@ class PermissionsGroup /** * @var string[] */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '[]', 'jsonb' => true])] private array $flags = []; /** diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index 448efbdd1..8a31779f9 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -45,7 +45,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter /** * Array where SAML attributes's data are stored. */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '[]', 'jsonb' => true])] private array $attributes = []; #[ORM\ManyToOne(targetEntity: Civility::class)] diff --git a/src/Bundle/ChillMainBundle/migrations/Version20240918150339.php b/src/Bundle/ChillMainBundle/migrations/Version20240918150339.php new file mode 100644 index 000000000..d0a4f858b --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20240918150339.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE chill_main_address DROP customs'); + $this->addSql('ALTER TABLE chill_main_dashboard_config_item ALTER metadata SET NOT NULL'); + $this->addSql('ALTER TABLE chill_main_location ALTER active SET NOT NULL'); + $this->addSql('ALTER TABLE chill_main_location_type ALTER active SET NOT NULL'); + $this->addSql('ALTER TABLE chill_main_location_type ALTER editablebyusers SET NOT NULL'); + $this->addSql('ALTER TABLE country ALTER name SET NOT NULL'); + $this->addSql('ALTER TABLE permission_groups ALTER name SET DEFAULT \'\''); + $this->addSql('ALTER TABLE users ALTER attributes SET DEFAULT \'[]\''); + } + + public function down(Schema $schema): void + { + } +} From a604f3947ca2a171d38fd3b56ad9f093c4e2f680 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 19 Sep 2024 14:38:23 +0200 Subject: [PATCH 04/16] Clean migration for job bundle --- .../src/migrations/Version20240918132916.php | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/Bundle/ChillJobBundle/src/migrations/Version20240918132916.php diff --git a/src/Bundle/ChillJobBundle/src/migrations/Version20240918132916.php b/src/Bundle/ChillJobBundle/src/migrations/Version20240918132916.php new file mode 100644 index 000000000..691ea8a4f --- /dev/null +++ b/src/Bundle/ChillJobBundle/src/migrations/Version20240918132916.php @@ -0,0 +1,90 @@ +addSql('ALTER INDEX chill_job.uniq_10864f31217bbb47 RENAME TO UNIQ_38D83C54217BBB47'); + $this->addSql('ALTER INDEX chill_job.idx_10864f312654b57d RENAME TO IDX_38D83C542654B57D'); + $this->addSql('ALTER INDEX chill_job.idx_10864f3154866550 RENAME TO IDX_38D83C5454866550'); + $this->addSql('ALTER INDEX chill_job.idx_10864f318825e118 RENAME TO IDX_38D83C548825E118'); + $this->addSql('ALTER INDEX chill_job.idx_10864f31a396afac RENAME TO IDX_38D83C54A396AFAC'); + $this->addSql('ALTER INDEX chill_job.idx_10864f3187541764 RENAME TO IDX_38D83C5487541764'); + $this->addSql('ALTER INDEX chill_job.idx_10864f315cfc2299 RENAME TO IDX_38D83C545CFC2299'); + $this->addSql('ALTER INDEX chill_job.idx_10864f3134fdf11d RENAME TO IDX_38D83C5434FDF11D'); + $this->addSql('ALTER INDEX chill_job.idx_10864f315742c99d RENAME TO IDX_38D83C545742C99D'); + $this->addSql('ALTER INDEX chill_job.idx_10864f31166494d4 RENAME TO IDX_38D83C54166494D4'); + $this->addSql('ALTER INDEX chill_job.idx_10864f3172820d66 RENAME TO IDX_38D83C5472820D66'); + $this->addSql('ALTER INDEX chill_job.idx_10864f31afa5e636 RENAME TO IDX_38D83C54AFA5E636'); + $this->addSql('ALTER INDEX chill_job.idx_10864f3161e05c22 RENAME TO IDX_38D83C5461E05C22'); + $this->addSql('ALTER INDEX chill_job.idx_10864f316f744bb0 RENAME TO IDX_38D83C546F744BB0'); + $this->addSql('ALTER INDEX chill_job.idx_10864f31ac39b1b RENAME TO IDX_38D83C54AC39B1B'); + $this->addSql('ALTER INDEX chill_job.idx_10864f3172a75b6d RENAME TO IDX_38D83C5472A75B6D'); + $this->addSql('ALTER INDEX chill_job.idx_10864f31d486e642 RENAME TO IDX_38D83C54D486E642'); + $this->addSql('ALTER INDEX chill_job.idx_3f24f812217bbb47 RENAME TO IDX_ED350AE5217BBB47'); + $this->addSql('ALTER INDEX chill_job.idx_102a1262ae1799d8 RENAME TO IDX_5BE81B7AAE1799D8'); + $this->addSql('ALTER INDEX chill_job.idx_20be09e2ae1799d8 RENAME TO IDX_E66356C7AE1799D8'); + $this->addSql('ALTER INDEX chill_job.idx_172eac0a217bbb47 RENAME TO IDX_EB9F6A40217BBB47'); + $this->addSql('ALTER INDEX chill_job.idx_fbb3cbb4217bbb47 RENAME TO IDX_D3EDB8D1217BBB47'); + $this->addSql('ALTER INDEX chill_job.idx_fbb3cbb4a4aeafea RENAME TO IDX_D3EDB8D1A4AEAFEA'); + $this->addSql('ALTER INDEX chill_job.idx_fbb3cbb435e47e35 RENAME TO IDX_D3EDB8D135E47E35'); + $this->addSql('ALTER INDEX chill_job.idx_fbb3cbb4b5e04267 RENAME TO IDX_D3EDB8D1B5E04267'); + $this->addSql('ALTER INDEX chill_job.idx_12e4ffbf217bbb47 RENAME TO IDX_BE1A1859217BBB47'); + $this->addSql('ALTER INDEX chill_job.idx_3280b96db87bf7b5 RENAME TO IDX_A90849FBB87BF7B5'); + $this->addSql('ALTER INDEX chill_job.idx_3280b96d7cde30dd RENAME TO IDX_A90849FB7CDE30DD'); + $this->addSql('ALTER INDEX chill_job.idx_e0501be0b87bf7b5 RENAME TO IDX_C623D20B87BF7B5'); + $this->addSql('ALTER INDEX chill_job.idx_e0501be07cde30dd RENAME TO IDX_C623D207CDE30DD'); + $this->addSql('ALTER INDEX chill_job.uniq_d9e9cabc77153098 RENAME TO UNIQ_6F7420EA77153098'); + $this->addSql('ALTER INDEX chill_job.idx_d9e9cabced16fa20 RENAME TO IDX_6F7420EAED16FA20'); + $this->addSql('ALTER INDEX chill_job.uniq_3274952577153098 RENAME TO UNIQ_E3F2021F77153098'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER INDEX chill_job.idx_a90849fb7cde30dd RENAME TO idx_3280b96d7cde30dd'); + $this->addSql('ALTER INDEX chill_job.idx_a90849fbb87bf7b5 RENAME TO idx_3280b96db87bf7b5'); + $this->addSql('ALTER INDEX chill_job.idx_d3edb8d1a4aeafea RENAME TO idx_fbb3cbb4a4aeafea'); + $this->addSql('ALTER INDEX chill_job.idx_d3edb8d1b5e04267 RENAME TO idx_fbb3cbb4b5e04267'); + $this->addSql('ALTER INDEX chill_job.idx_d3edb8d1217bbb47 RENAME TO idx_fbb3cbb4217bbb47'); + $this->addSql('ALTER INDEX chill_job.idx_d3edb8d135e47e35 RENAME TO idx_fbb3cbb435e47e35'); + $this->addSql('ALTER INDEX chill_job.idx_6f7420eaed16fa20 RENAME TO idx_d9e9cabced16fa20'); + $this->addSql('ALTER INDEX chill_job.uniq_6f7420ea77153098 RENAME TO uniq_d9e9cabc77153098'); + $this->addSql('ALTER INDEX chill_job.idx_be1a1859217bbb47 RENAME TO idx_12e4ffbf217bbb47'); + $this->addSql('ALTER INDEX chill_job.idx_c623d20b87bf7b5 RENAME TO idx_e0501be0b87bf7b5'); + $this->addSql('ALTER INDEX chill_job.idx_c623d207cde30dd RENAME TO idx_e0501be07cde30dd'); + $this->addSql('ALTER INDEX chill_job.uniq_e3f2021f77153098 RENAME TO uniq_3274952577153098'); + $this->addSql('ALTER INDEX chill_job.idx_eb9f6a40217bbb47 RENAME TO idx_172eac0a217bbb47'); + $this->addSql('ALTER INDEX chill_job.idx_e66356c7ae1799d8 RENAME TO idx_20be09e2ae1799d8'); + $this->addSql('ALTER INDEX chill_job.idx_5be81b7aae1799d8 RENAME TO idx_102a1262ae1799d8'); + $this->addSql('ALTER INDEX chill_job.idx_ed350ae5217bbb47 RENAME TO idx_3f24f812217bbb47'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c5472820d66 RENAME TO idx_10864f3172820d66'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c5434fdf11d RENAME TO idx_10864f3134fdf11d'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c5454866550 RENAME TO idx_10864f3154866550'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c5472a75b6d RENAME TO idx_10864f3172a75b6d'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c542654b57d RENAME TO idx_10864f312654b57d'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c54ac39b1b RENAME TO idx_10864f31ac39b1b'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c54a396afac RENAME TO idx_10864f31a396afac'); + $this->addSql('ALTER INDEX chill_job.uniq_38d83c54217bbb47 RENAME TO uniq_10864f31217bbb47'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c545cfc2299 RENAME TO idx_10864f315cfc2299'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c5487541764 RENAME TO idx_10864f3187541764'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c5461e05c22 RENAME TO idx_10864f3161e05c22'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c545742c99d RENAME TO idx_10864f315742c99d'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c54166494d4 RENAME TO idx_10864f31166494d4'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c546f744bb0 RENAME TO idx_10864f316f744bb0'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c548825e118 RENAME TO idx_10864f318825e118'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c54d486e642 RENAME TO idx_10864f31d486e642'); + $this->addSql('ALTER INDEX chill_job.idx_38d83c54afa5e636 RENAME TO idx_10864f31afa5e636'); + } +} From 877c33e4ce71fce1281ee3329b1ae25225884472 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 19 Sep 2024 14:38:45 +0200 Subject: [PATCH 05/16] Clean migration for person bundle --- .../AccompanyingPeriod/ClosingMotive.php | 2 +- .../Household/HouseholdCompositionType.php | 2 +- .../Entity/Relationships/Relation.php | 2 +- .../migrations/Version20240918130649.php | 33 +++++++++++++++++ .../migrations/Version20240918151852.php | 35 +++++++++++++++++++ 5 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20240918130649.php create mode 100644 src/Bundle/ChillPersonBundle/migrations/Version20240918151852.php diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php index fc61aed9e..50cd3a88c 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/ClosingMotive.php @@ -45,7 +45,7 @@ class ClosingMotive #[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])] private array $name = []; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, options: ['default' => 0.0])] private float $ordering = 0.0; #[ORM\ManyToOne(targetEntity: ClosingMotive::class, inversedBy: 'children')] diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php index 695105084..9d172f5be 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdCompositionType.php @@ -29,7 +29,7 @@ class HouseholdCompositionType private ?int $id = null; #[Serializer\Groups(['read', 'docgen:read'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, options: ['default' => '{}', 'jsonb' => true])] #[Serializer\Context(['is-translatable' => true], groups: ['docgen:read'])] private array $label = []; diff --git a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php index 56d051608..2c4999616 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php +++ b/src/Bundle/ChillPersonBundle/Entity/Relationships/Relation.php @@ -27,7 +27,7 @@ class Relation private ?int $id = null; #[Serializer\Groups(['read'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, nullable: true)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => true])] private bool $isActive = true; #[Serializer\Groups(['read'])] diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20240918130649.php b/src/Bundle/ChillPersonBundle/migrations/Version20240918130649.php new file mode 100644 index 000000000..1583ea6d0 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20240918130649.php @@ -0,0 +1,33 @@ +addSql('COMMENT ON COLUMN chill_person_household_composition.createdAt IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN chill_person_household_composition.updatedAt IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN chill_person_household_members.startDate IS \'(DC2Type:date_immutable)\''); + $this->addSql('COMMENT ON COLUMN chill_person_household_members.endDate IS \'(DC2Type:date_immutable)\''); + $this->addSql('COMMENT ON COLUMN chill_person_person.phonenumber IS \'(DC2Type:phone_number)\''); + $this->addSql('COMMENT ON COLUMN chill_person_person.mobilenumber IS \'(DC2Type:phone_number)\''); + $this->addSql('COMMENT ON COLUMN chill_person_phone.phonenumber IS \'(DC2Type:phone_number)\''); + $this->addSql('COMMENT ON COLUMN chill_person_resource.createdAt IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN chill_person_resource.updatedAt IS \'(DC2Type:datetime_immutable)\''); + } + + public function down(Schema $schema): void + { + } +} diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20240918151852.php b/src/Bundle/ChillPersonBundle/migrations/Version20240918151852.php new file mode 100644 index 000000000..0de63bb1e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20240918151852.php @@ -0,0 +1,35 @@ +addSql('ALTER TABLE chill_person_accompanying_period_participation ALTER startdate DROP DEFAULT'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_user_history ALTER startdate SET DEFAULT \'now()\''); + $this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER privatecomment_comments SET NOT NULL'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_work_referrer ALTER id DROP DEFAULT'); + $this->addSql('ALTER TABLE chill_person_household_composition_type ALTER label SET DEFAULT \'{}\''); + $this->addSql('ALTER TABLE chill_person_household_composition_type ALTER label SET NOT NULL'); + $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber SET NOT NULL'); + $this->addSql('ALTER TABLE chill_person_relationships ALTER createdby_id DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_relationships ALTER createdat DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_resource ALTER createdby_id DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_resource ALTER createdat DROP NOT NULL'); + } + + public function down(Schema $schema): void + { + } +} From fa8f6d6f15d57cf3b4d886261f6ef5ac786dd885 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 19 Sep 2024 14:39:03 +0200 Subject: [PATCH 06/16] Clean migration for thirdparty bundle --- .../Entity/ThirdParty.php | 2 +- .../migrations/Version20240918152229.php | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillThirdPartyBundle/migrations/Version20240918152229.php diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index a905b3ffb..eb35aea4d 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -200,7 +200,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin * [fr] Qualité. */ #[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] - #[ORM\Column(name: 'profession', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false)] + #[ORM\Column(name: 'profession', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] #[Context(normalizationContext: ['groups' => 'docgen:read'], groups: ['docgen:read:3party:parent'])] private string $profession = ''; diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20240918152229.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20240918152229.php new file mode 100644 index 000000000..cb99c74cd --- /dev/null +++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20240918152229.php @@ -0,0 +1,26 @@ +addSql('ALTER TABLE chill_3party.third_party DROP profession_id'); + $this->addSql('ALTER TABLE chill_3party.third_party ALTER firstname SET NOT NULL'); + } + + public function down(Schema $schema): void + { + } +} From ddc48db06f35b4c86d30ead615b3f3e774eefa79 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 1 Nov 2024 10:40:00 +0100 Subject: [PATCH 07/16] Clean taskbundle migration --- .../migrations/Version20241101093514.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Bundle/ChillTaskBundle/migrations/Version20241101093514.php diff --git a/src/Bundle/ChillTaskBundle/migrations/Version20241101093514.php b/src/Bundle/ChillTaskBundle/migrations/Version20241101093514.php new file mode 100644 index 000000000..71ec995e7 --- /dev/null +++ b/src/Bundle/ChillTaskBundle/migrations/Version20241101093514.php @@ -0,0 +1,29 @@ +addSql('ALTER TABLE chill_task.recurring_task ALTER current_states SET DEFAULT \'[]\''); + $this->addSql('ALTER TABLE chill_task.single_task ALTER current_states SET DEFAULT \'[]\''); + + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_task.single_task ALTER current_states DROP DEFAULT'); + $this->addSql('ALTER TABLE chill_task.recurring_task ALTER current_states DROP DEFAULT'); + } +} From a97a586b9d34a1ea19dc829239f478e0aa5564d3 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Nov 2024 14:42:40 +0100 Subject: [PATCH 08/16] Clean migrations of index rename statements --- .../migrations/Version20241101100750.php | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20241101100750.php diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241101100750.php b/src/Bundle/ChillMainBundle/migrations/Version20241101100750.php new file mode 100644 index 000000000..8a82155e1 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20241101100750.php @@ -0,0 +1,56 @@ +addSql('ALTER INDEX idx_154a075fef1a9d84 RENAME TO IDX_589D51B4EF1A9D84'); + $this->addSql('ALTER INDEX idx_154a075fa76ed395 RENAME TO IDX_589D51B4A76ED395'); + $this->addSql('ALTER INDEX idx_a9f001fa7e6af9d4 RENAME TO IDX_D63001607E6AF9D4'); + $this->addSql('ALTER INDEX idx_a9f001faa76ed395 RENAME TO IDX_D6300160A76ED395'); + $this->addSql('ALTER INDEX idx_64a4a621504cb38d RENAME TO IDX_E260A868504CB38D'); + $this->addSql('ALTER INDEX idx_92351ece727aca70 RENAME TO IDX_72D110E8727ACA70'); + $this->addSql('ALTER INDEX idx_person_center RENAME TO IDX_BF210A145932F377'); + $this->addSql('ALTER INDEX idx_3370d4403818da5 RENAME TO IDX_BF210A143818DA5'); + $this->addSql('ALTER INDEX idx_3370d4401c9da55 RENAME TO IDX_BF210A141C9DA55'); + $this->addSql('ALTER INDEX idx_9bc1fd50f5b7af75 RENAME TO IDX_B9CEBEACF5B7AF75'); + $this->addSql('ALTER INDEX idx_9bc1fd50dca38092 RENAME TO IDX_B9CEBEACDCA38092'); + $this->addSql('ALTER INDEX idx_9bc1fd508dfc48dc RENAME TO IDX_B9CEBEAC8DFC48DC'); + $this->addSql('ALTER INDEX idx_9bc1fd50217bbb47 RENAME TO IDX_B9CEBEAC217BBB47'); + $this->addSql('ALTER INDEX idx_40fb5d6dfec418b RENAME TO IDX_7A6FDBEFEC418B'); + $this->addSql('ALTER INDEX idx_286dc95df53b66 RENAME TO IDX_7A48DF7F5DF53B66'); + $this->addSql('ALTER INDEX idx_a14d8f3d447bbb3b RENAME TO IDX_A14D8F3D96DF1F10'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER INDEX idx_72d110e8727aca70 RENAME TO idx_92351ece727aca70'); + $this->addSql('ALTER INDEX idx_589d51b4a76ed395 RENAME TO idx_154a075fa76ed395'); + $this->addSql('ALTER INDEX idx_589d51b4ef1a9d84 RENAME TO idx_154a075fef1a9d84'); + $this->addSql('ALTER INDEX idx_bf210a143818da5 RENAME TO idx_3370d4403818da5'); + $this->addSql('ALTER INDEX idx_bf210a141c9da55 RENAME TO idx_3370d4401c9da55'); + $this->addSql('ALTER INDEX idx_bf210a145932f377 RENAME TO idx_person_center'); + $this->addSql('ALTER INDEX idx_e260a868504cb38d RENAME TO idx_64a4a621504cb38d'); + $this->addSql('ALTER INDEX idx_d63001607e6af9d4 RENAME TO idx_a9f001fa7e6af9d4'); + $this->addSql('ALTER INDEX idx_d6300160a76ed395 RENAME TO idx_a9f001faa76ed395'); + $this->addSql('ALTER INDEX idx_7a48df7f5df53b66 RENAME TO idx_286dc95df53b66'); + $this->addSql('ALTER INDEX idx_a14d8f3d96df1f10 RENAME TO idx_a14d8f3d447bbb3b'); + $this->addSql('ALTER INDEX idx_b9cebeacdca38092 RENAME TO idx_9bc1fd50dca38092'); + $this->addSql('ALTER INDEX idx_b9cebeacf5b7af75 RENAME TO idx_9bc1fd50f5b7af75'); + $this->addSql('ALTER INDEX idx_b9cebeac8dfc48dc RENAME TO idx_9bc1fd508dfc48dc'); + $this->addSql('ALTER INDEX idx_b9cebeac217bbb47 RENAME TO idx_9bc1fd50217bbb47'); + $this->addSql('ALTER INDEX idx_7a6fdbefec418b RENAME TO idx_40fb5d6dfec418b'); + } +} From 31912b9b911fe96ad62b3c7ed1ef050f9ca492fe Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Nov 2024 14:43:38 +0100 Subject: [PATCH 09/16] Clean migration of NULL definition on entity properties --- .../Entity/CustomFieldsGroup.php | 2 +- .../migrations/Version20241104085341.php | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20241104085341.php diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php index 723b47612..265dd972b 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php @@ -49,7 +49,7 @@ class CustomFieldsGroup #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array|string $name; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: true)] private array $options = []; /** diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php b/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php new file mode 100644 index 000000000..90b58e1ba --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php @@ -0,0 +1,53 @@ +addSql('ALTER TABLE activity ALTER privatecomment_comments SET NOT NULL'); + $this->addSql('ALTER TABLE activityreason ALTER name SET NOT NULL'); + $this->addSql('ALTER TABLE activityreasoncategory ALTER name SET NOT NULL'); + $this->addSql('ALTER TABLE chill_main_dashboard_config_item ALTER metadata SET NOT NULL'); + $this->addSql('ALTER TABLE chill_main_location_type ALTER editablebyusers SET NOT NULL'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER privatecomment_comments SET NOT NULL'); + $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber SET NOT NULL'); + $this->addSql('ALTER TABLE chill_person_relationships ALTER createdby_id DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_relationships ALTER createdat DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_resource ALTER createdby_id DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_resource ALTER createdat DROP NOT NULL'); + $this->addSql('ALTER TABLE country ALTER name SET NOT NULL'); + $this->addSql('ALTER TABLE customfield ALTER required SET NOT NULL'); + $this->addSql('ALTER TABLE chill_3party.third_party ALTER firstname SET NOT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER privateComment_comments DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_main_location_type ALTER editableByUsers DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_main_dashboard_config_item ALTER metadata DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_3party.third_party ALTER firstname DROP NOT NULL'); + $this->addSql('ALTER TABLE country ALTER name DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_household_composition_type ALTER label DROP NOT NULL'); + $this->addSql('ALTER TABLE customfieldsgroup ALTER options DROP NOT NULL'); + $this->addSql('ALTER TABLE activity ALTER privateComment_comments DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_resource ALTER createdAt SET NOT NULL'); + $this->addSql('ALTER TABLE chill_person_resource ALTER createdBy_id SET NOT NULL'); + $this->addSql('ALTER TABLE activityreasoncategory ALTER name DROP NOT NULL'); + $this->addSql('ALTER TABLE activityreason ALTER name DROP NOT NULL'); + $this->addSql('ALTER TABLE customfield ALTER required DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_relations ALTER isActive SET NOT NULL'); + } +} From 9698a5e9870f2220c51ffa5da13f0f46343362f8 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Nov 2024 15:18:59 +0100 Subject: [PATCH 10/16] Clean migration of default definitions for entity properties --- .../Entity/CustomField.php | 2 +- .../Entity/CustomFieldLongChoice/Option.php | 2 +- .../Entity/CustomFieldsGroup.php | 2 +- src/Bundle/ChillEventBundle/Entity/Event.php | 2 +- .../migrations/Version20241104135957.php | 28 +++++++++++++++++++ 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20241104135957.php diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php index 06ff658c7..04cdd2308 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomField.php @@ -48,7 +48,7 @@ class CustomField #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] private ?float $ordering = null; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] private false $required = false; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)] diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php index c8bdc6031..bd98cec68 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldLongChoice/Option.php @@ -33,7 +33,7 @@ class Option #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id = null; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 50, name: 'internal_key')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 50, name: 'internal_key', options: ['default' => ''])] private string $internalKey = ''; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 15)] diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php index 265dd972b..b50596eab 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php @@ -49,7 +49,7 @@ class CustomFieldsGroup #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] private array|string $name; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: true)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: true, options: ['default' => '{}', 'jsonb' => true])] private array $options = []; /** diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php index 2c2105b55..c065ed94f 100644 --- a/src/Bundle/ChillEventBundle/Entity/Event.php +++ b/src/Bundle/ChillEventBundle/Entity/Event.php @@ -85,7 +85,7 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter #[ORM\JoinTable('chill_event_event_documents')] private Collection $documents; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DECIMAL, precision: 10, scale: 4, nullable: true, options: ['default' => null])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DECIMAL, precision: 10, scale: 4, nullable: true, options: ['default' => '0.0'])] private string $organizationCost = '0.0'; /** diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241104135957.php b/src/Bundle/ChillMainBundle/migrations/Version20241104135957.php new file mode 100644 index 000000000..af081b147 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20241104135957.php @@ -0,0 +1,28 @@ +addSql('ALTER TABLE chill_event_event ALTER organizationcost DROP DEFAULT'); + $this->addSql('ALTER TABLE chill_person_accompanying_period_user_history ALTER startdate SET DEFAULT \'now()\''); + $this->addSql('ALTER TABLE chill_event_event ALTER organizationcost SET DEFAULT \'0.0\''); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_event_event ALTER organizationCost SET DEFAULT \'0.0\''); + } +} From 55c4ba3f04c57fd925ccb5498103e3686cc39d2b Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Nov 2024 15:36:51 +0100 Subject: [PATCH 11/16] Clean migration with diverse alter type statements + drop cfdata_old on chill_person_person table --- .../migrations/Version20241104142216.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20241104142216.php diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241104142216.php b/src/Bundle/ChillMainBundle/migrations/Version20241104142216.php new file mode 100644 index 000000000..798339ed9 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20241104142216.php @@ -0,0 +1,35 @@ +addSql('ALTER TABLE chill_main_postal_code ALTER center TYPE geometry(POINT,4326) USING center::geometry(POINT,4326);'); + $this->addSql('ALTER TABLE chill_person_marital_status ALTER id TYPE VARCHAR(7)'); + $this->addSql('ALTER TABLE chill_person_person DROP cfdata_old'); + $this->addSql('ALTER TABLE chill_person_person ALTER maritalstatus_id TYPE VARCHAR(7)'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_person ADD cfdata_old TEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE chill_person_person ALTER cFData DROP NOT NULL'); + $this->addSql('ALTER TABLE chill_person_person ALTER maritalStatus_id TYPE VARCHAR(10)'); + $this->addSql('COMMENT ON COLUMN chill_person_person.cfdata_old IS \'(DC2Type:array)\''); + $this->addSql('ALTER TABLE chill_person_marital_status ALTER id TYPE VARCHAR(10)'); + $this->addSql('ALTER TABLE chill_main_postal_code ALTER center TYPE VARCHAR(255)'); + + } +} From b01c9b86dbbb1c882b5a35f7806c75e7bfba7e91 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Nov 2024 15:37:43 +0100 Subject: [PATCH 12/16] php cs fixer --- .../migrations/Version20240918142723.php | 7 +++++++ .../migrations/Version20240918143139.php | 7 +++++++ .../src/migrations/Version20240918132916.php | 7 +++++++ .../migrations/Version20240918150339.php | 11 ++++++++--- .../migrations/Version20241101100750.php | 7 +++++++ .../migrations/Version20241104085341.php | 7 +++++++ .../migrations/Version20241104135957.php | 7 +++++++ .../migrations/Version20241104142216.php | 7 +++++++ .../migrations/Version20240918130649.php | 11 ++++++++--- .../migrations/Version20240918151852.php | 11 ++++++++--- .../migrations/Version20241101093514.php | 7 +++++++ .../migrations/Version20240918152229.php | 11 ++++++++--- 12 files changed, 88 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20240918142723.php b/src/Bundle/ChillActivityBundle/migrations/Version20240918142723.php index d453a9bbc..8f0973853 100644 --- a/src/Bundle/ChillActivityBundle/migrations/Version20240918142723.php +++ b/src/Bundle/ChillActivityBundle/migrations/Version20240918142723.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Activity; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php b/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php index ace30aaac..feacd41e8 100644 --- a/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php +++ b/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Budget; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillJobBundle/src/migrations/Version20240918132916.php b/src/Bundle/ChillJobBundle/src/migrations/Version20240918132916.php index 691ea8a4f..68cd49d3d 100644 --- a/src/Bundle/ChillJobBundle/src/migrations/Version20240918132916.php +++ b/src/Bundle/ChillJobBundle/src/migrations/Version20240918132916.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Job; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillMainBundle/migrations/Version20240918150339.php b/src/Bundle/ChillMainBundle/migrations/Version20240918150339.php index d0a4f858b..cd0e17fd1 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20240918150339.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20240918150339.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Main; use Doctrine\DBAL\Schema\Schema; @@ -26,7 +33,5 @@ final class Version20240918150339 extends AbstractMigration $this->addSql('ALTER TABLE users ALTER attributes SET DEFAULT \'[]\''); } - public function down(Schema $schema): void - { - } + public function down(Schema $schema): void {} } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241101100750.php b/src/Bundle/ChillMainBundle/migrations/Version20241101100750.php index 8a82155e1..9c1e99ad8 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20241101100750.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20241101100750.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Main; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php b/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php index 90b58e1ba..cb09a632a 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Main; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241104135957.php b/src/Bundle/ChillMainBundle/migrations/Version20241104135957.php index af081b147..8693ebbe0 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20241104135957.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20241104135957.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Main; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241104142216.php b/src/Bundle/ChillMainBundle/migrations/Version20241104142216.php index 798339ed9..bce990be2 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20241104142216.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20241104142216.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Main; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20240918130649.php b/src/Bundle/ChillPersonBundle/migrations/Version20240918130649.php index 1583ea6d0..3c427999d 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20240918130649.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20240918130649.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Person; use Doctrine\DBAL\Schema\Schema; @@ -27,7 +34,5 @@ final class Version20240918130649 extends AbstractMigration $this->addSql('COMMENT ON COLUMN chill_person_resource.updatedAt IS \'(DC2Type:datetime_immutable)\''); } - public function down(Schema $schema): void - { - } + public function down(Schema $schema): void {} } diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20240918151852.php b/src/Bundle/ChillPersonBundle/migrations/Version20240918151852.php index 0de63bb1e..27827a86d 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20240918151852.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20240918151852.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Person; use Doctrine\DBAL\Schema\Schema; @@ -29,7 +36,5 @@ final class Version20240918151852 extends AbstractMigration $this->addSql('ALTER TABLE chill_person_resource ALTER createdat DROP NOT NULL'); } - public function down(Schema $schema): void - { - } + public function down(Schema $schema): void {} } diff --git a/src/Bundle/ChillTaskBundle/migrations/Version20241101093514.php b/src/Bundle/ChillTaskBundle/migrations/Version20241101093514.php index 71ec995e7..4640d7e5e 100644 --- a/src/Bundle/ChillTaskBundle/migrations/Version20241101093514.php +++ b/src/Bundle/ChillTaskBundle/migrations/Version20241101093514.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\Task; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20240918152229.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20240918152229.php index cb99c74cd..bc42f3012 100644 --- a/src/Bundle/ChillThirdPartyBundle/migrations/Version20240918152229.php +++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20240918152229.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * Chill is a software for social workers + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Chill\Migrations\ThirdParty; use Doctrine\DBAL\Schema\Schema; @@ -20,7 +27,5 @@ final class Version20240918152229 extends AbstractMigration $this->addSql('ALTER TABLE chill_3party.third_party ALTER firstname SET NOT NULL'); } - public function down(Schema $schema): void - { - } + public function down(Schema $schema): void {} } From 5eec4f1281ebaeee2fa6aacfeef7ab3a4070ce62 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Nov 2024 17:47:08 +0100 Subject: [PATCH 13/16] Fix pipeline rector and phpunit --- .../Entity/ActivityReasonCategory.php | 2 +- .../migrations/Version20240918143139.php | 35 ------------------- 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php index 3555cd8fc..37316615c 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php @@ -129,7 +129,7 @@ class ActivityReasonCategory implements \Stringable * * @return ActivityReasonCategory */ - public function setName($name) + public function setName(array $name) { $this->name = $name; diff --git a/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php b/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php deleted file mode 100644 index feacd41e8..000000000 --- a/src/Bundle/ChillBudgetBundle/migrations/Version20240918143139.php +++ /dev/null @@ -1,35 +0,0 @@ -addSql('ALTER TABLE chill_budget.charge DROP familymember_id'); - $this->addSql('ALTER TABLE chill_budget.resource DROP familymember_id'); - } - - public function down(Schema $schema): void - { - $this->addSql('ALTER TABLE chill_budget.resource ADD familymember_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE chill_budget.charge ADD familymember_id INT DEFAULT NULL'); - } -} From 9c918a151c4a60d6de20d0ebac3eb5a1767d4fdf Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 4 Nov 2024 17:58:43 +0100 Subject: [PATCH 14/16] Php cs fix --- .../ChillActivityBundle/Entity/ActivityReasonCategory.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php index 37316615c..c344fc539 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityReasonCategory.php @@ -125,8 +125,6 @@ class ActivityReasonCategory implements \Stringable /** * Set name. * - * @param array $name - * * @return ActivityReasonCategory */ public function setName(array $name) From 6ebab8e4fbbcbfaa24b11a1cb19204aa29e40a7e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 20 Nov 2024 14:23:00 +0100 Subject: [PATCH 15/16] Process review of migrations --- .../migrations/Version20241104135957.php | 2 +- .../ChillMainBundle/migrations/Version20241104085341.php | 6 ------ .../migrations/Version20241104142216.php | 5 +---- 3 files changed, 2 insertions(+), 11 deletions(-) rename src/Bundle/{ChillMainBundle => ChillEventBundle}/migrations/Version20241104135957.php (96%) rename src/Bundle/{ChillMainBundle => ChillPersonBundle}/migrations/Version20241104142216.php (83%) diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241104135957.php b/src/Bundle/ChillEventBundle/migrations/Version20241104135957.php similarity index 96% rename from src/Bundle/ChillMainBundle/migrations/Version20241104135957.php rename to src/Bundle/ChillEventBundle/migrations/Version20241104135957.php index 8693ebbe0..291e6cadc 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20241104135957.php +++ b/src/Bundle/ChillEventBundle/migrations/Version20241104135957.php @@ -9,7 +9,7 @@ declare(strict_types=1); * the LICENSE file that was distributed with this source code. */ -namespace Chill\Migrations\Main; +namespace Chill\Migrations\Event; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php b/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php index cb09a632a..d1b44bda8 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20241104085341.php @@ -23,9 +23,6 @@ final class Version20241104085341 extends AbstractMigration public function up(Schema $schema): void { - $this->addSql('ALTER TABLE activity ALTER privatecomment_comments SET NOT NULL'); - $this->addSql('ALTER TABLE activityreason ALTER name SET NOT NULL'); - $this->addSql('ALTER TABLE activityreasoncategory ALTER name SET NOT NULL'); $this->addSql('ALTER TABLE chill_main_dashboard_config_item ALTER metadata SET NOT NULL'); $this->addSql('ALTER TABLE chill_main_location_type ALTER editablebyusers SET NOT NULL'); $this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER privatecomment_comments SET NOT NULL'); @@ -49,11 +46,8 @@ final class Version20241104085341 extends AbstractMigration $this->addSql('ALTER TABLE country ALTER name DROP NOT NULL'); $this->addSql('ALTER TABLE chill_person_household_composition_type ALTER label DROP NOT NULL'); $this->addSql('ALTER TABLE customfieldsgroup ALTER options DROP NOT NULL'); - $this->addSql('ALTER TABLE activity ALTER privateComment_comments DROP NOT NULL'); $this->addSql('ALTER TABLE chill_person_resource ALTER createdAt SET NOT NULL'); $this->addSql('ALTER TABLE chill_person_resource ALTER createdBy_id SET NOT NULL'); - $this->addSql('ALTER TABLE activityreasoncategory ALTER name DROP NOT NULL'); - $this->addSql('ALTER TABLE activityreason ALTER name DROP NOT NULL'); $this->addSql('ALTER TABLE customfield ALTER required DROP NOT NULL'); $this->addSql('ALTER TABLE chill_person_relations ALTER isActive SET NOT NULL'); } diff --git a/src/Bundle/ChillMainBundle/migrations/Version20241104142216.php b/src/Bundle/ChillPersonBundle/migrations/Version20241104142216.php similarity index 83% rename from src/Bundle/ChillMainBundle/migrations/Version20241104142216.php rename to src/Bundle/ChillPersonBundle/migrations/Version20241104142216.php index bce990be2..5ad28eba7 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20241104142216.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20241104142216.php @@ -9,7 +9,7 @@ declare(strict_types=1); * the LICENSE file that was distributed with this source code. */ -namespace Chill\Migrations\Main; +namespace Chill\Migrations\Person; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -23,7 +23,6 @@ final class Version20241104142216 extends AbstractMigration public function up(Schema $schema): void { - $this->addSql('ALTER TABLE chill_main_postal_code ALTER center TYPE geometry(POINT,4326) USING center::geometry(POINT,4326);'); $this->addSql('ALTER TABLE chill_person_marital_status ALTER id TYPE VARCHAR(7)'); $this->addSql('ALTER TABLE chill_person_person DROP cfdata_old'); $this->addSql('ALTER TABLE chill_person_person ALTER maritalstatus_id TYPE VARCHAR(7)'); @@ -36,7 +35,5 @@ final class Version20241104142216 extends AbstractMigration $this->addSql('ALTER TABLE chill_person_person ALTER maritalStatus_id TYPE VARCHAR(10)'); $this->addSql('COMMENT ON COLUMN chill_person_person.cfdata_old IS \'(DC2Type:array)\''); $this->addSql('ALTER TABLE chill_person_marital_status ALTER id TYPE VARCHAR(10)'); - $this->addSql('ALTER TABLE chill_main_postal_code ALTER center TYPE VARCHAR(255)'); - } } From 4bc92a61ca85b80fefae535421bc7bf3c1964db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 29 Nov 2024 12:09:03 +0100 Subject: [PATCH 16/16] Fix typo --- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 6c71eba95..fb084e2a6 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -153,7 +153,7 @@ Reset: 'Remise à zéro' 'Person Menu': 'Menu usager' 'The person data are not valid': 'Les données de votre formulaire sont invalides.' 'The person has been created': 'Le dossier a été créé' -'Person search results': 'Recherche de usagers' +'Person search results': 'Recherche d''usagers' Person search results by phonenumber: Recherche d'usager par numéro de téléphone 'Search within persons': 'Recherche parmi les usagers' Open person file: Ouvrir le dossier de l'usager