From de711181dfcf7e77dfcdadb3796e24c8bae19d11 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 19 Sep 2024 14:37:31 +0200 Subject: [PATCH] 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'); + } +}