migrations/Version20220919143352.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 Version20220919143352 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 medical_facility DROP FOREIGN KEY FK_6CC379E5F92F3E70');
  19.         $this->addSql('DROP TABLE medical_facility');
  20.     }
  21.     public function getDescription(): string
  22.     {
  23.         return
  24.             "- Introduces medical_facility 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 medical_facility (
  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 medical facility\',
  37.                     address VARCHAR(225) DEFAULT NULL COMMENT \'Postal address for medical facility\',
  38.                     zip_code VARCHAR(16) NOT NULL COMMENT \'Zip code of address for medical facility\',
  39.                     city VARCHAR(225) NOT NULL COMMENT \'City of address for medical facility\',
  40.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  41.                     INDEX IDX_6CC379E5F92F3E70 (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 medical_facility ADD CONSTRAINT FK_6CC379E5F92F3E70 FOREIGN KEY
  49.                     (country_id) REFERENCES country (id) ON DELETE SET NULL
  50.             '
  51.         );
  52.     }
  53. }