migrations/Version20250113202216.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. final class Version20250113202216 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Remove dict_applicant_type table';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         // this up() migration is auto-generated, please modify it to your needs
  15.         $this->addSql('ALTER TABLE applicant DROP CONSTRAINT fk_caad1019b309296a');
  16.         $this->addSql('ALTER TABLE dict_applicant_type DROP CONSTRAINT fk_6b0157d916fe72e1');
  17.         $this->addSql('ALTER TABLE dict_applicant_type DROP CONSTRAINT fk_6b0157d9de12ab56');
  18.         $this->addSql('DROP TABLE dict_applicant_type');
  19.         $this->addSql('DROP INDEX idx_caad1019b309296a');
  20.         $this->addSql('ALTER TABLE applicant DROP applicant_type_id');
  21.     }
  22.     public function down(Schema $schema): void
  23.     {
  24.         // this down() migration is auto-generated, please modify it to your needs
  25.         $this->addSql('CREATE SCHEMA public');
  26.         $this->addSql('CREATE TABLE dict_applicant_type (id UUID NOT NULL, created_by UUID DEFAULT NULL, updated_by UUID DEFAULT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
  27.         $this->addSql('CREATE UNIQUE INDEX uniq_6b0157d977153098 ON dict_applicant_type (code)');
  28.         $this->addSql('CREATE UNIQUE INDEX uniq_6b0157d95e237e06 ON dict_applicant_type (name)');
  29.         $this->addSql('CREATE INDEX idx_6b0157d9de12ab56 ON dict_applicant_type (created_by)');
  30.         $this->addSql('CREATE INDEX idx_6b0157d916fe72e1 ON dict_applicant_type (updated_by)');
  31.         $this->addSql('COMMENT ON COLUMN dict_applicant_type.id IS \'(DC2Type:uuid)\'');
  32.         $this->addSql('COMMENT ON COLUMN dict_applicant_type.created_by IS \'(DC2Type:uuid)\'');
  33.         $this->addSql('COMMENT ON COLUMN dict_applicant_type.updated_by IS \'(DC2Type:uuid)\'');
  34.         $this->addSql('ALTER TABLE dict_applicant_type ADD CONSTRAINT fk_6b0157d916fe72e1 FOREIGN KEY (updated_by) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  35.         $this->addSql('ALTER TABLE dict_applicant_type ADD CONSTRAINT fk_6b0157d9de12ab56 FOREIGN KEY (created_by) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  36.         $this->addSql('ALTER TABLE applicant ADD applicant_type_id UUID DEFAULT NULL');
  37.         $this->addSql('COMMENT ON COLUMN applicant.applicant_type_id IS \'(DC2Type:uuid)\'');
  38.         $this->addSql('ALTER TABLE applicant ADD CONSTRAINT fk_caad1019b309296a FOREIGN KEY (applicant_type_id) REFERENCES dict_applicant_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  39.         $this->addSql('CREATE INDEX idx_caad1019b309296a ON applicant (applicant_type_id)');
  40.     }
  41. }