migrations/Version20230611133608.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. final class Version20230611133608 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Region data';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql("
  15.             INSERT INTO `region` (`id`, `parent_id`, `name`)
  16.                 VALUES
  17.                 (1, NULL, 'Africa'),
  18.                 (2, NULL, 'Americas'),
  19.                 (3, NULL, 'Asia'),
  20.                 (4, NULL, 'Europe'),
  21.                 (5, NULL, 'Oceania')
  22.         ");
  23.         $this->addSql("
  24.             INSERT INTO `region` (`id`, `parent_id`, `name`)
  25.                 VALUES
  26.                 (6, 1, 'Northern Africa'),
  27.                 (7, 1, 'Sub-Saharan Africa'),
  28.                 (8, 2, 'Latin America and the Caribbean'),
  29.                 (9, 2, 'Northern America'),
  30.                 (10, 3, 'Central Asia'),
  31.                 (11, 3, 'Eastern Asia'),
  32.                 (12, 3, 'South-eastern Asia'),
  33.                 (13, 3, 'Southern Asia'),
  34.                 (14, 3, 'Western Asia'),
  35.                 (15, 4, 'Eastern Europe'),
  36.                 (16, 4, 'Northern Europe'),
  37.                 (17, 4, 'Southern Europe'),
  38.                 (18, 4, 'Western Europe'),
  39.                 (19, 5, 'Australia and New Zealand'),
  40.                 (20, 5, 'Melanesia'),
  41.                 (21, 5, 'Micronesia'),
  42.                 (22, 5, 'Polynesia')
  43.         ");
  44.     }
  45.     public function down(Schema $schema): void
  46.     {
  47.         $this->addSql('DELETE FROM `region`');
  48.     }
  49. }