migrations/Version20220622193151.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 Version20220622193151 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 activity (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, date_start DATETIME DEFAULT NULL, date_end DATETIME NOT NULL, date_register_start DATETIME NOT NULL, date_register_end DATETIME NOT NULL, price NUMERIC(5, 2) NOT NULL, note LONGTEXT DEFAULT 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('ALTER TABLE school_activity ADD activity_id INT NOT NULL, DROP title, DROP slug, DROP description, DROP date_start, DROP date_end, DROP date_register_start, DROP date_register_end, DROP price, DROP note, DROP created_at, DROP updated_at');
  20.         $this->addSql('ALTER TABLE school_activity ADD CONSTRAINT FK_52323D1E81C06096 FOREIGN KEY (activity_id) REFERENCES activity (id)');
  21.         $this->addSql('CREATE UNIQUE INDEX UNIQ_52323D1E81C06096 ON school_activity (activity_id)');
  22.         $this->addSql('ALTER TABLE stage_activity ADD activity_id INT NOT NULL, DROP title, DROP slug, DROP description, DROP date_start, DROP date_end, DROP date_register_start, DROP date_register_end, DROP price, DROP note, DROP created_at, DROP updated_at');
  23.         $this->addSql('ALTER TABLE stage_activity ADD CONSTRAINT FK_A493CD3781C06096 FOREIGN KEY (activity_id) REFERENCES activity (id)');
  24.         $this->addSql('CREATE UNIQUE INDEX UNIQ_A493CD3781C06096 ON stage_activity (activity_id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE school_activity DROP FOREIGN KEY FK_52323D1E81C06096');
  30.         $this->addSql('ALTER TABLE stage_activity DROP FOREIGN KEY FK_A493CD3781C06096');
  31.         $this->addSql('DROP TABLE activity');
  32.         $this->addSql('DROP INDEX UNIQ_52323D1E81C06096 ON school_activity');
  33.         $this->addSql('ALTER TABLE school_activity ADD title VARCHAR(255) NOT NULL, ADD slug VARCHAR(255) NOT NULL, ADD description LONGTEXT NOT NULL, ADD date_start DATETIME DEFAULT NULL, ADD date_end DATETIME NOT NULL, ADD date_register_start DATETIME NOT NULL, ADD date_register_end DATETIME NOT NULL, ADD price NUMERIC(5, 2) NOT NULL, ADD note LONGTEXT DEFAULT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP activity_id');
  34.         $this->addSql('DROP INDEX UNIQ_A493CD3781C06096 ON stage_activity');
  35.         $this->addSql('ALTER TABLE stage_activity ADD title VARCHAR(255) NOT NULL, ADD slug VARCHAR(255) NOT NULL, ADD description LONGTEXT NOT NULL, ADD date_start DATETIME DEFAULT NULL, ADD date_end DATETIME NOT NULL, ADD date_register_start DATETIME NOT NULL, ADD date_register_end DATETIME NOT NULL, ADD price NUMERIC(5, 2) NOT NULL, ADD note LONGTEXT DEFAULT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP activity_id');
  36.     }
  37. }