chore(migrations): normaliser le schema

This commit is contained in:
2026-01-15 13:42:36 +01:00
parent ea45ce9d0a
commit 9abe9fea7f
6 changed files with 274 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20261120140000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Convert custom_fields.options from text[] to json.';
}
public function up(Schema $schema): void
{
$this->addSql("ALTER TABLE custom_fields ALTER COLUMN options TYPE JSON USING to_json(options)");
}
public function down(Schema $schema): void
{
$this->addSql("ALTER TABLE custom_fields ALTER COLUMN options TYPE TEXT[] USING ARRAY(SELECT json_array_elements_text(options))");
}
}