migrations/Version20230328123537.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. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20230328123537 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 job_school_subject (id INT AUTO_INCREMENT NOT NULL, abbreviation VARCHAR(10) NOT NULL, subject_name VARCHAR(191) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE job_school_subject_mapping (id INT AUTO_INCREMENT NOT NULL, job_id INT DEFAULT NULL, job_school_subject_id INT DEFAULT NULL, INDEX IDX_E4B9D019BE04EA9 (job_id), INDEX IDX_E4B9D019B3999C80 (job_school_subject_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE job_workfield_subject_mapping (id INT AUTO_INCREMENT NOT NULL, job_workfield_id INT DEFAULT NULL, job_school_subject_id INT DEFAULT NULL, INDEX IDX_AF8B3FD1EAD7CBC0 (job_workfield_id), INDEX IDX_AF8B3FD1B3999C80 (job_school_subject_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE job_school_subject_mapping ADD CONSTRAINT FK_E4B9D019BE04EA9 FOREIGN KEY (job_id) REFERENCES job (id)');
  22.         $this->addSql('ALTER TABLE job_school_subject_mapping ADD CONSTRAINT FK_E4B9D019B3999C80 FOREIGN KEY (job_school_subject_id) REFERENCES job_school_subject (id)');
  23.         $this->addSql('ALTER TABLE job_workfield_subject_mapping ADD CONSTRAINT FK_AF8B3FD1EAD7CBC0 FOREIGN KEY (job_workfield_id) REFERENCES job_workfield (id)');
  24.         $this->addSql('ALTER TABLE job_workfield_subject_mapping ADD CONSTRAINT FK_AF8B3FD1B3999C80 FOREIGN KEY (job_school_subject_id) REFERENCES job_school_subject (id)');
  25.         $this->addSql('ALTER TABLE job ADD show_school_subjects TINYINT(1) DEFAULT 0 NOT NULL');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('ALTER TABLE job_school_subject_mapping DROP FOREIGN KEY FK_E4B9D019B3999C80');
  31.         $this->addSql('ALTER TABLE job_workfield_subject_mapping DROP FOREIGN KEY FK_AF8B3FD1B3999C80');
  32.         $this->addSql('DROP TABLE job_school_subject');
  33.         $this->addSql('DROP TABLE job_school_subject_mapping');
  34.         $this->addSql('DROP TABLE job_workfield_subject_mapping');
  35.         $this->addSql('ALTER TABLE job DROP show_school_subjects');
  36.     }
  37. }