migrations/Version20201104043411.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 Version20201104043411 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $this->addSql('CREATE TABLE event_price (id INT AUTO_INCREMENT NOT NULL, event_id INT NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_8BD393F571F7E88B (event_id), INDEX IDX_8BD393F5DE12AB56 (created_by), INDEX IDX_8BD393F516FE72E1 (updated_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE event_type_price (id INT AUTO_INCREMENT NOT NULL, event_type_id INT NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_9C2A7C01401B253C (event_type_id), INDEX IDX_9C2A7C01DE12AB56 (created_by), INDEX IDX_9C2A7C0116FE72E1 (updated_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE ticket_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('INSERT INTO ticket_type (id, name) VALUES (1, "Default")');
  23.         $this->addSql('ALTER TABLE event_price ADD CONSTRAINT FK_8BD393F571F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
  24.         $this->addSql('ALTER TABLE event_price ADD CONSTRAINT FK_8BD393F5DE12AB56 FOREIGN KEY (created_by) REFERENCES fos_user (id)');
  25.         $this->addSql('ALTER TABLE event_price ADD CONSTRAINT FK_8BD393F516FE72E1 FOREIGN KEY (updated_by) REFERENCES fos_user (id)');
  26.         $this->addSql('ALTER TABLE event_type_price ADD CONSTRAINT FK_9C2A7C01401B253C FOREIGN KEY (event_type_id) REFERENCES event_type (id)');
  27.         $this->addSql('ALTER TABLE event_type_price ADD CONSTRAINT FK_9C2A7C01DE12AB56 FOREIGN KEY (created_by) REFERENCES fos_user (id)');
  28.         $this->addSql('ALTER TABLE event_type_price ADD CONSTRAINT FK_9C2A7C0116FE72E1 FOREIGN KEY (updated_by) REFERENCES fos_user (id)');
  29.         $this->addSql('ALTER TABLE event_type CHANGE image image VARCHAR(255) DEFAULT NULL');
  30.     }
  31.     public function down(Schema $schema) : void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  35.         $this->addSql('DROP TABLE event_price');
  36.         $this->addSql('DROP TABLE event_type_price');
  37.         $this->addSql('DROP TABLE ticket_type');
  38.         $this->addSql('ALTER TABLE event_type CHANGE image image VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
  39.     }
  40. }