migrations/Version20220111011957.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 Version20220111011957 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 court (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE program_court (program_id INT NOT NULL, court_id INT NOT NULL, INDEX IDX_FDC76AC93EB8070A (program_id), INDEX IDX_FDC76AC9E3184009 (court_id), PRIMARY KEY(program_id, court_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE program_court ADD CONSTRAINT FK_FDC76AC93EB8070A FOREIGN KEY (program_id) REFERENCES program (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE program_court ADD CONSTRAINT FK_FDC76AC9E3184009 FOREIGN KEY (court_id) REFERENCES court (id) ON DELETE CASCADE');
  22.         $this->addSql('ALTER TABLE program DROP tennis_court');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE program_court DROP FOREIGN KEY FK_FDC76AC9E3184009');
  28.         $this->addSql('DROP TABLE court');
  29.         $this->addSql('DROP TABLE program_court');
  30.         $this->addSql('ALTER TABLE program ADD tennis_court LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:array)\'');
  31.     }
  32. }