<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20251106090800 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE channel_positioning_test_blocks ADD mandatory_info TEXT DEFAULT NULL, ADD example_enabled TINYINT(1) DEFAULT 1 NOT NULL, ADD example_label VARCHAR(255) DEFAULT NULL, ADD example_description TEXT DEFAULT NULL, ADD example_answers JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE channel_positioning_test_blocks DROP mandatory_info, DROP example_enabled, DROP example_label, DROP example_description, DROP example_answers');
}
public function postUp(Schema $schema): void
{
$this->connection->executeStatement(
'UPDATE `channel_positioning_test_blocks` SET mandatory_info = :text WHERE mandatory_info IS NULL',
['text' => "Chaque question est obligatoire. Une fois validé, le formulaire n’est plus modifiable.\nVeuillez vérifier vos réponses avant toute validation."]
);
$this->connection->executeStatement(
'UPDATE `channel_positioning_test_blocks` SET example_label = :text WHERE example_label IS NULL',
['text' => 'Quel(s) élément(s) sont nécessaires pour faire pousser une plante ?']
);
$this->connection->executeStatement(
'UPDATE `channel_positioning_test_blocks` SET example_description = :text WHERE example_description IS NULL',
['text' => '(Plusieurs réponses possibles)']
);
$answers = [
[
'label' => 'La lumière du soleil',
'valid' => true,
],
[
'label' => 'Le Wi-Fi',
'valid' => false,
],
[
'label' => 'De l\'eau',
'valid' => true,
],
[
'label' => 'De la terre',
'valid' => true,
],
];
$this->connection->executeStatement(
'UPDATE `channel_positioning_test_blocks` SET example_answers = :array WHERE example_answers IS NULL',
['array' => json_encode($answers)]
);
}
}