migrations/Version20220314194048.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 Version20220314194048 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(
  19.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  20.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  21.         );
  22.         $this->addSql('CREATE TABLE category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  23.         $this->abortIf(
  24.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  25.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  26.         );
  27.         $this->addSql('CREATE TABLE layer (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, name VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, image VARCHAR(1024) CHARACTER SET utf8 DEFAULT \'NULL\' COLLATE `utf8_unicode_ci`, INDEX IDX_E4DB211A12469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  28.         $this->abortIf(
  29.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  30.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  31.         );
  32.         $this->addSql('CREATE TABLE layer_race (layer_id INT NOT NULL, race_id INT NOT NULL, INDEX IDX_E5A60F5EA6EFDCD (layer_id), INDEX IDX_E5A60F56E59D40D (race_id), PRIMARY KEY(layer_id, race_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  33.         $this->abortIf(
  34.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  35.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  36.         );
  37.         $this->addSql('CREATE TABLE race (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  38.         $this->abortIf(
  39.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  40.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  41.         );
  42.         $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, roles LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_bin`, password VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  43.     }
  44.     public function down(Schema $schema): void
  45.     {
  46.         // this down() migration is auto-generated, please modify it to your needs
  47.         $this->abortIf(
  48.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  49.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  50.         );
  51.         $this->addSql('DROP TABLE category');
  52.         $this->abortIf(
  53.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  54.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  55.         );
  56.         $this->addSql('DROP TABLE layer');
  57.         $this->abortIf(
  58.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  59.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  60.         );
  61.         $this->addSql('DROP TABLE layer_race');
  62.         $this->abortIf(
  63.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  64.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  65.         );
  66.         $this->addSql('DROP TABLE race');
  67.         $this->abortIf(
  68.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL80Platform,
  69.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQL80Platform'."
  70.         );
  71.         $this->addSql('DROP TABLE user');
  72.     }
  73. }