<?php
/**
* @noinspection PhpUnused
* @noinspection PhpInternalEntityUsedInspection
*/
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Validator\Constraints\Api\CoreModule\Module\AbstractModuleIdCompound;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*
* @package API
* @internal
*/
final class Version20230201134409 extends AbstractMigration
{
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
public function getDescription(): string
{
return
"- Seeding of module table.";
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs.
// Uncomment when every module is enabled
// $list = '(\'' . implode('\'),(\'', AbstractModuleIdCompound::ENABLED_CHOICES) .
// '\');';
// $this->addSql(
// "
// INSERT INTO module
// (id)
// VALUES
// $list
// "
// );
// temporary migration script
$values = [];
foreach (AbstractModuleIdCompound::ACTIVE_MODULE_IDS as $moduleId => $isActive) {
$values[] = "('{$moduleId}', {$isActive})";
}
$list = implode(',', $values);
$this->addSql(
"
INSERT INTO module
(id, active)
VALUES
$list
"
);
}
}