27 lines
694 B
PHP
27 lines
694 B
PHP
<?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))");
|
|
}
|
|
}
|