<?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 Version20240730112437 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 booking_school_class (id INT AUTO_INCREMENT NOT NULL, school_class_id INT DEFAULT NULL, booking_id INT DEFAULT NULL, person_count INT DEFAULT 0 NOT NULL, INDEX IDX_D12E4E4A14463F54 (school_class_id), INDEX IDX_D12E4E4A3301C60 (booking_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE booking_school_class ADD CONSTRAINT FK_D12E4E4A14463F54 FOREIGN KEY (school_class_id) REFERENCES school_class (id)');
$this->addSql('ALTER TABLE booking_school_class ADD CONSTRAINT FK_D12E4E4A3301C60 FOREIGN KEY (booking_id) REFERENCES booking (id)');
$this->addSql('ALTER TABLE booking DROP FOREIGN KEY FK_E00CEDDE14463F54');
$this->addSql('DROP INDEX IDX_E00CEDDE14463F54 ON booking');
$this->addSql('ALTER TABLE booking ADD etermin_id VARCHAR(100) DEFAULT NULL, DROP school_class_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE booking_school_class DROP FOREIGN KEY FK_D12E4E4A14463F54');
$this->addSql('ALTER TABLE booking_school_class DROP FOREIGN KEY FK_D12E4E4A3301C60');
$this->addSql('DROP TABLE booking_school_class');
$this->addSql('ALTER TABLE booking ADD school_class_id INT DEFAULT NULL, DROP etermin_id');
$this->addSql('ALTER TABLE booking ADD CONSTRAINT FK_E00CEDDE14463F54 FOREIGN KEY (school_class_id) REFERENCES school_class (id)');
$this->addSql('CREATE INDEX IDX_E00CEDDE14463F54 ON booking (school_class_id)');
}
}