migrations/Version20250409085325.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.  * @author
  12.  * @internal
  13.  */
  14. final class Version20250409085325 extends AbstractMigration
  15. {
  16.     public function down(Schema $schema): void
  17.     {
  18.         // this down() migration is auto-generated, please modify it to your needs
  19.         $this->addSql('ALTER TABLE sob_record DROP FOREIGN KEY FK_108B18328C03F15C');
  20.         $this->addSql('ALTER TABLE sob_record DROP FOREIGN KEY FK_108B1832F92F3E70');
  21.         $this->addSql('ALTER TABLE sob_record DROP FOREIGN KEY FK_108B18323E859F62');
  22.         $this->addSql('DROP TABLE sob_record');
  23.     }
  24.     public function getDescription(): string
  25.     {
  26.         return
  27.             "- Introduces sob_record table.";
  28.     }
  29.     public function up(Schema $schema): void
  30.     {
  31.         // this up() migration is auto-generated, please modify it to your needs
  32.         $this->addSql(
  33.             '
  34.                 CREATE TABLE sob_record (
  35.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  36.                     employee_id INT NOT NULL COMMENT \'Internal ID\',
  37.                     country_id VARCHAR(2) DEFAULT NULL COMMENT \'Country code in upper case (ISO 3166-1 Alpha-2)\',
  38.                     address VARCHAR(225) DEFAULT NULL COMMENT \'Optional social consultant address\',
  39.                     zip_code VARCHAR(16) DEFAULT NULL COMMENT \'Optional social consultant zip code\',
  40.                     city VARCHAR(225) DEFAULT NULL COMMENT \'Optional social consultant city\',
  41.                     phone VARCHAR(225) DEFAULT NULL COMMENT \'Optional phone number\',
  42.                     lock_status_reason VARCHAR(225) DEFAULT \'ENTITY_CREATED\' NOT NULL
  43.                         COMMENT \'Lock status reason for the record\',
  44.                     employee_consent_confirmation_user_id INT DEFAULT NULL COMMENT \'Internal ID\',
  45.                     employee_consent_confirmation_date DATE DEFAULT NULL COMMENT \'Employee consent confirmation date.\',
  46.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  47.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  48.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  49.                     updated INT DEFAULT NULL COMMENT \'Entity update date as UNIX timestamp\',
  50.                     UNIQUE INDEX UNIQ_108B18328C03F15C (employee_id),
  51.                     INDEX IDX_108B1832F92F3E70 (country_id),
  52.                     INDEX IDX_108B18323E859F62 (employee_consent_confirmation_user_id),
  53.                     PRIMARY KEY(id)
  54.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  55.             '
  56.         );
  57.         $this->addSql(
  58.             '
  59.                 ALTER TABLE sob_record ADD CONSTRAINT FK_108B18328C03F15C
  60.                     FOREIGN KEY (employee_id) REFERENCES employee (id);
  61.             '
  62.         );
  63.         $this->addSql(
  64.             '
  65.                 ALTER TABLE sob_record ADD CONSTRAINT FK_108B1832F92F3E70
  66.                     FOREIGN KEY (country_id) REFERENCES country (id) ON DELETE SET NULL;
  67.             '
  68.         );
  69.         $this->addSql(
  70.             '
  71.                 ALTER TABLE sob_record ADD CONSTRAINT FK_108B18323E859F62
  72.                     FOREIGN KEY (employee_consent_confirmation_user_id) REFERENCES user (id);
  73.             '
  74.         );
  75.     }
  76. }