<?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 Version20240506173717 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('CREATE TABLE school_report_card_absence (id INT AUTO_INCREMENT NOT NULL, establishment_id INT NOT NULL, school_year_id INT NOT NULL, school_year_periode_id INT NOT NULL, student_registration_id INT NOT NULL, classroom_id INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_by INT NOT NULL, updated_by INT NOT NULL, total_absence DOUBLE PRECISION DEFAULT NULL, justified_absence DOUBLE PRECISION DEFAULT NULL, unjustified_absence DOUBLE PRECISION DEFAULT NULL, INDEX IDX_6FCACEFC8565851 (establishment_id), INDEX IDX_6FCACEFCD2EECC3F (school_year_id), INDEX IDX_6FCACEFCD17A6B27 (school_year_periode_id), INDEX IDX_6FCACEFCDF990765 (student_registration_id), INDEX IDX_6FCACEFC6278D5A8 (classroom_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFC8565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
$this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFCD2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
$this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFCD17A6B27 FOREIGN KEY (school_year_periode_id) REFERENCES school_year_periode (id)');
$this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFCDF990765 FOREIGN KEY (student_registration_id) REFERENCES registration_student_registration (id)');
$this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFC6278D5A8 FOREIGN KEY (classroom_id) REFERENCES setting_classroom (id)');
$this->addSql('ALTER TABLE school_report_card ADD school_report_card_absence_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE school_report_card ADD CONSTRAINT FK_363E4798F4579E85 FOREIGN KEY (school_report_card_absence_id) REFERENCES school_report_card_absence (id)');
$this->addSql('CREATE INDEX IDX_363E4798F4579E85 ON school_report_card (school_report_card_absence_id)');
$this->addSql('ALTER TABLE stock_kit_category DROP FOREIGN KEY FK_19C0F12AD2EECC3F');
$this->addSql('DROP INDEX fk_19c0f12ad2eecc3f ON stock_kit_category');
$this->addSql('CREATE INDEX IDX_19C0F12AD2EECC3F ON stock_kit_category (school_year_id)');
$this->addSql('ALTER TABLE stock_kit_category ADD CONSTRAINT FK_19C0F12AD2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE school_report_card DROP FOREIGN KEY FK_363E4798F4579E85');
$this->addSql('DROP TABLE school_report_card_absence');
$this->addSql('DROP INDEX IDX_363E4798F4579E85 ON school_report_card');
$this->addSql('ALTER TABLE school_report_card DROP school_report_card_absence_id');
$this->addSql('ALTER TABLE stock_kit_category DROP FOREIGN KEY FK_19C0F12AD2EECC3F');
$this->addSql('DROP INDEX idx_19c0f12ad2eecc3f ON stock_kit_category');
$this->addSql('CREATE INDEX FK_19C0F12AD2EECC3F ON stock_kit_category (school_year_id)');
$this->addSql('ALTER TABLE stock_kit_category ADD CONSTRAINT FK_19C0F12AD2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
}
}