migrations/Version20220917144607.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 Version20220917144607 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\PostgreSQL100Platform,
  20.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  21.         );
  22.         $this->addSql('CREATE TABLE filter_options (id INT NOT NULL, fk_config_geo_server_id INT DEFAULT NULL, label VARCHAR(255) DEFAULT NULL, cql VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
  23.         $this->addSql('CREATE INDEX idx_67a58de2d1a31eec ON filter_options (fk_config_geo_server_id)');
  24.         $this->abortIf(
  25.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  26.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  27.         );
  28.         $this->addSql('CREATE TABLE filter_range (id INT NOT NULL, cql VARCHAR(255) NOT NULL, comma BOOLEAN NOT NULL, units VARCHAR(255) DEFAULT NULL, range_min INT DEFAULT NULL, range_max INT DEFAULT NULL, default_min INT DEFAULT NULL, default_max INT DEFAULT NULL, PRIMARY KEY(id))');
  29.         $this->abortIf(
  30.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  31.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  32.         );
  33.         $this->addSql('CREATE TABLE config_geo_server (id INT NOT NULL, fk_filter_range_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, cluster VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, filter BOOLEAN DEFAULT NULL, type_filter VARCHAR(16) DEFAULT NULL, style VARCHAR(255) DEFAULT NULL, default_value VARCHAR(255) DEFAULT NULL, multiple BOOLEAN DEFAULT NULL, "position" INT DEFAULT NULL, PRIMARY KEY(id))');
  34.         $this->addSql('CREATE INDEX idx_a9b576aece4e8124 ON config_geo_server (fk_filter_range_id)');
  35.         $this->abortIf(
  36.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  37.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  38.         );
  39.         $this->addSql('CREATE TABLE "user" (id INT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, name VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
  40.         $this->addSql('CREATE UNIQUE INDEX uniq_8d93d649e7927c74 ON "user" (email)');
  41.         $this->abortIf(
  42.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  43.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  44.         );
  45.         $this->addSql('CREATE TABLE layers (id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, name_geo_server VARCHAR(255) DEFAULT NULL, static BOOLEAN DEFAULT NULL, zoom_min INT DEFAULT NULL, zoom_max INT DEFAULT NULL, "position" INT DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, token BOOLEAN DEFAULT NULL, auth_key VARCHAR(255) DEFAULT NULL, opacity DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id))');
  46.         $this->abortIf(
  47.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  48.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  49.         );
  50.         $this->addSql('CREATE TABLE styles (id INT NOT NULL, fk_config_geo_server_id INT DEFAULT NULL, label VARCHAR(255) DEFAULT NULL, color VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
  51.         $this->addSql('CREATE INDEX idx_b65afaf5d1a31eec ON styles (fk_config_geo_server_id)');
  52.     }
  53.     public function down(Schema $schema): void
  54.     {
  55.         // this down() migration is auto-generated, please modify it to your needs
  56.         $this->abortIf(
  57.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  58.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  59.         );
  60.         $this->addSql('DROP TABLE filter_options');
  61.         $this->abortIf(
  62.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  63.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  64.         );
  65.         $this->addSql('DROP TABLE filter_range');
  66.         $this->abortIf(
  67.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  68.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  69.         );
  70.         $this->addSql('DROP TABLE config_geo_server');
  71.         $this->abortIf(
  72.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  73.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  74.         );
  75.         $this->addSql('DROP TABLE "user"');
  76.         $this->abortIf(
  77.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  78.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  79.         );
  80.         $this->addSql('DROP TABLE layers');
  81.         $this->abortIf(
  82.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\PostgreSQL100Platform,
  83.             "Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQL100Platform'."
  84.         );
  85.         $this->addSql('DROP TABLE styles');
  86.     }
  87. }