migrations/Version20220711133620.php line 1

Open in your IDE?
  1. <?php
  2. /* @noinspection PhpUnused */
  3. declare(strict_types=1);
  4. namespace DoctrineMigrations;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. /**
  8.  * Auto-generated Migration: Please modify to your needs!
  9.  *
  10.  * @package API
  11.  * @internal
  12.  */
  13. final class Version20220711133620 extends AbstractMigration
  14. {
  15.     public function down(Schema $schema): void
  16.     {
  17.         // this down() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE health_insurance_provider DROP FOREIGN KEY FK_3319F7CF92F3E70');
  19.         $this->addSql('DROP TABLE health_insurance_provider');
  20.     }
  21.     public function getDescription(): string
  22.     {
  23.         return
  24.             "- Introduces health_insurance_provider table.";
  25.     }
  26.     public function up(Schema $schema): void
  27.     {
  28.         // this up() migration is auto-generated, please modify it to your needs
  29.         $this->addSql(
  30.             '
  31.                 CREATE TABLE health_insurance_provider (
  32.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  33.                     country_id VARCHAR(2) DEFAULT NULL COMMENT \'Country code in upper case (ISO 3166-1 Alpha-2)\',
  34.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  35.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  36.                     name VARCHAR(225) NOT NULL COMMENT \'Name for health insurance provider\',
  37.                     address VARCHAR(225) DEFAULT NULL COMMENT \'Postal address for health insurance provider\',
  38.                     zip_code VARCHAR(16) NOT NULL COMMENT \'Zip code of address for health insurance provider\',
  39.                     city VARCHAR(225) NOT NULL COMMENT \'City of address for health insurance provider\',
  40.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  41.                     INDEX IDX_3319F7CF92F3E70 (country_id),
  42.                     PRIMARY KEY(id)
  43.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  44.             '
  45.         );
  46.         $this->addSql(
  47.             '
  48.                 ALTER TABLE health_insurance_provider ADD CONSTRAINT FK_3319F7CF92F3E70 FOREIGN KEY
  49.                     (country_id) REFERENCES country (id) ON DELETE SET NULL
  50.             '
  51.         );
  52.     }
  53. }