src/Migrations/Version20210811092249.php line 1

  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 Version20210811092249 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->addSql('CREATE TABLE olymp_online_attendant (id INT AUTO_INCREMENT NOT NULL, country_id INT DEFAULT NULL, region_id INT DEFAULT NULL, confirmed TINYINT(1) NOT NULL, first_name VARCHAR(255) NOT NULL, middle_name VARCHAR(255) DEFAULT NULL, last_name VARCHAR(255) NOT NULL, phone VARCHAR(50) DEFAULT NULL, email VARCHAR(50) DEFAULT NULL, education VARCHAR(255) DEFAULT NULL, address_registration LONGTEXT DEFAULT NULL, address_fact LONGTEXT DEFAULT NULL, is_test_data TINYINT(1) DEFAULT \'0\' NOT NULL, work_place VARCHAR(255) DEFAULT NULL, work_position VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, p_series VARCHAR(255) DEFAULT NULL, p_number VARCHAR(255) DEFAULT NULL, p_department_name LONGTEXT DEFAULT NULL, p_issue_date DATETIME DEFAULT NULL, p_department_code VARCHAR(255) DEFAULT NULL, INDEX IDX_876A2094F92F3E70 (country_id), INDEX IDX_876A209498260155 (region_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE olymp_online_attendant_participants (id INT AUTO_INCREMENT NOT NULL, participant_id INT NOT NULL, attendant_id INT NOT NULL, attorney_id INT DEFAULT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, INDEX IDX_5175FC5C9D1C3019 (participant_id), INDEX IDX_5175FC5C4DE0C235 (attendant_id), INDEX IDX_5175FC5C36175919 (attorney_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE olymp_online_attendant ADD CONSTRAINT FK_876A2094F92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
  21.         $this->addSql('ALTER TABLE olymp_online_attendant ADD CONSTRAINT FK_876A209498260155 FOREIGN KEY (region_id) REFERENCES federal_region (id)');
  22.         $this->addSql('ALTER TABLE olymp_online_attendant_participants ADD CONSTRAINT FK_5175FC5C9D1C3019 FOREIGN KEY (participant_id) REFERENCES olymp_online_participant (id)');
  23.         $this->addSql('ALTER TABLE olymp_online_attendant_participants ADD CONSTRAINT FK_5175FC5C4DE0C235 FOREIGN KEY (attendant_id) REFERENCES olymp_online_attendant (id)');
  24.         $this->addSql('ALTER TABLE olymp_online_attendant_participants ADD CONSTRAINT FK_5175FC5C36175919 FOREIGN KEY (attorney_id) REFERENCES files (id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE olymp_online_attendant_participants DROP FOREIGN KEY FK_5175FC5C4DE0C235');
  30.         $this->addSql('DROP TABLE olymp_online_attendant');
  31.         $this->addSql('DROP TABLE olymp_online_attendant_participants');
  32.     }
  33. }