migrations/Version20240506173717.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20240506173717 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFC8565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
  20.         $this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFCD2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
  21.         $this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFCD17A6B27 FOREIGN KEY (school_year_periode_id) REFERENCES school_year_periode (id)');
  22.         $this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFCDF990765 FOREIGN KEY (student_registration_id) REFERENCES registration_student_registration (id)');
  23.         $this->addSql('ALTER TABLE school_report_card_absence ADD CONSTRAINT FK_6FCACEFC6278D5A8 FOREIGN KEY (classroom_id) REFERENCES setting_classroom (id)');
  24.         $this->addSql('ALTER TABLE school_report_card ADD school_report_card_absence_id INT DEFAULT NULL');
  25.         $this->addSql('ALTER TABLE school_report_card ADD CONSTRAINT FK_363E4798F4579E85 FOREIGN KEY (school_report_card_absence_id) REFERENCES school_report_card_absence (id)');
  26.         $this->addSql('CREATE INDEX IDX_363E4798F4579E85 ON school_report_card (school_report_card_absence_id)');
  27.         $this->addSql('ALTER TABLE stock_kit_category DROP FOREIGN KEY FK_19C0F12AD2EECC3F');
  28.         $this->addSql('DROP INDEX fk_19c0f12ad2eecc3f ON stock_kit_category');
  29.         $this->addSql('CREATE INDEX IDX_19C0F12AD2EECC3F ON stock_kit_category (school_year_id)');
  30.         $this->addSql('ALTER TABLE stock_kit_category ADD CONSTRAINT FK_19C0F12AD2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
  31.     }
  32.     public function down(Schema $schema): void
  33.     {
  34.         // this down() migration is auto-generated, please modify it to your needs
  35.         $this->addSql('ALTER TABLE school_report_card DROP FOREIGN KEY FK_363E4798F4579E85');
  36.         $this->addSql('DROP TABLE school_report_card_absence');
  37.         $this->addSql('DROP INDEX IDX_363E4798F4579E85 ON school_report_card');
  38.         $this->addSql('ALTER TABLE school_report_card DROP school_report_card_absence_id');
  39.         $this->addSql('ALTER TABLE stock_kit_category DROP FOREIGN KEY FK_19C0F12AD2EECC3F');
  40.         $this->addSql('DROP INDEX idx_19c0f12ad2eecc3f ON stock_kit_category');
  41.         $this->addSql('CREATE INDEX FK_19C0F12AD2EECC3F ON stock_kit_category (school_year_id)');
  42.         $this->addSql('ALTER TABLE stock_kit_category ADD CONSTRAINT FK_19C0F12AD2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
  43.     }
  44. }