Clean migration for thirdparty bundle

This commit is contained in:
Julie Lenaerts 2024-09-19 14:39:03 +02:00 committed by Julien Fastré
parent 877c33e4ce
commit fa8f6d6f15
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 27 additions and 1 deletions

View File

@ -200,7 +200,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface, \Strin
* [fr] Qualité. * [fr] Qualité.
*/ */
#[Groups(['read', 'write', 'docgen:read', 'docgen:read:3party:parent'])] #[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'])] #[Context(normalizationContext: ['groups' => 'docgen:read'], groups: ['docgen:read:3party:parent'])]
private string $profession = ''; private string $profession = '';

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\ThirdParty;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20240918152229 extends AbstractMigration
{
public function getDescription(): string
{
return 'Drop foreign key profession_id and set not null on firstname';
}
public function up(Schema $schema): void
{
$this->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
{
}
}