<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20260427011000 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Synchronise les commentaires datetime et les noms d’index après ajout des modules académiques';
    }

    public function up(Schema $schema): void
    {
        $this->addSql('ALTER TABLE annees_scolaires CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
        $this->addSql('ALTER TABLE classes CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
        $this->addSql('ALTER TABLE ecoles CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
        $this->addSql('ALTER TABLE niveaux CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
        $this->addSql('ALTER TABLE sections CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
        $this->addSql('ALTER TABLE themes CHANGE created_at created_at DATETIME NOT NULL');
        $this->addSql('ALTER TABLE users CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');

        $this->addSql('ALTER TABLE annees_scolaires RENAME INDEX IDX_4C3DBF6B716F1E3 TO IDX_EE66055577EF1B1E');
        $this->addSql('ALTER TABLE annees_scolaires RENAME INDEX IDX_4C3DBF6BD823E37A TO IDX_EE660555D823E37A');
        $this->addSql('ALTER TABLE classes RENAME INDEX IDX_8F87BF96716F1E3 TO IDX_2ED7EC577EF1B1E');
        $this->addSql('ALTER TABLE classes RENAME INDEX IDX_8F87BF96D823E37A TO IDX_2ED7EC5D823E37A');
        $this->addSql('ALTER TABLE classes RENAME INDEX IDX_8F87BF96B3E9C81 TO IDX_2ED7EC5B3E9C81');
        $this->addSql('ALTER TABLE classes RENAME INDEX IDX_8F87BF96E0C82FDD TO IDX_2ED7EC59331C741');
        $this->addSql('ALTER TABLE niveaux RENAME INDEX IDX_4E82760B716F1E3 TO IDX_56F771A077EF1B1E');
        $this->addSql('ALTER TABLE niveaux RENAME INDEX IDX_4E82760BD823E37A TO IDX_56F771A0D823E37A');
        $this->addSql('ALTER TABLE sections RENAME INDEX IDX_2D737AE2716F1E3 TO IDX_2B96439877EF1B1E');
    }

    public function down(Schema $schema): void
    {
        $this->addSql('ALTER TABLE sections RENAME INDEX IDX_2B96439877EF1B1E TO IDX_2D737AE2716F1E3');
        $this->addSql('ALTER TABLE niveaux RENAME INDEX IDX_56F771A077EF1B1E TO IDX_4E82760B716F1E3');
        $this->addSql('ALTER TABLE niveaux RENAME INDEX IDX_56F771A0D823E37A TO IDX_4E82760BD823E37A');
        $this->addSql('ALTER TABLE classes RENAME INDEX IDX_2ED7EC577EF1B1E TO IDX_8F87BF96716F1E3');
        $this->addSql('ALTER TABLE classes RENAME INDEX IDX_2ED7EC5D823E37A TO IDX_8F87BF96D823E37A');
        $this->addSql('ALTER TABLE classes RENAME INDEX IDX_2ED7EC5B3E9C81 TO IDX_8F87BF96B3E9C81');
        $this->addSql('ALTER TABLE classes RENAME INDEX IDX_2ED7EC59331C741 TO IDX_8F87BF96E0C82FDD');
        $this->addSql('ALTER TABLE annees_scolaires RENAME INDEX IDX_EE66055577EF1B1E TO IDX_4C3DBF6B716F1E3');
        $this->addSql('ALTER TABLE annees_scolaires RENAME INDEX IDX_EE660555D823E37A TO IDX_4C3DBF6BD823E37A');
    }
}
