<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250113202216 extends AbstractMigration
{
public function getDescription(): string
{
return 'Remove dict_applicant_type table';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE applicant DROP CONSTRAINT fk_caad1019b309296a');
$this->addSql('ALTER TABLE dict_applicant_type DROP CONSTRAINT fk_6b0157d916fe72e1');
$this->addSql('ALTER TABLE dict_applicant_type DROP CONSTRAINT fk_6b0157d9de12ab56');
$this->addSql('DROP TABLE dict_applicant_type');
$this->addSql('DROP INDEX idx_caad1019b309296a');
$this->addSql('ALTER TABLE applicant DROP applicant_type_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$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))');
$this->addSql('CREATE UNIQUE INDEX uniq_6b0157d977153098 ON dict_applicant_type (code)');
$this->addSql('CREATE UNIQUE INDEX uniq_6b0157d95e237e06 ON dict_applicant_type (name)');
$this->addSql('CREATE INDEX idx_6b0157d9de12ab56 ON dict_applicant_type (created_by)');
$this->addSql('CREATE INDEX idx_6b0157d916fe72e1 ON dict_applicant_type (updated_by)');
$this->addSql('COMMENT ON COLUMN dict_applicant_type.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN dict_applicant_type.created_by IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN dict_applicant_type.updated_by IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE dict_applicant_type ADD CONSTRAINT fk_6b0157d916fe72e1 FOREIGN KEY (updated_by) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE dict_applicant_type ADD CONSTRAINT fk_6b0157d9de12ab56 FOREIGN KEY (created_by) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE applicant ADD applicant_type_id UUID DEFAULT NULL');
$this->addSql('COMMENT ON COLUMN applicant.applicant_type_id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE applicant ADD CONSTRAINT fk_caad1019b309296a FOREIGN KEY (applicant_type_id) REFERENCES dict_applicant_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_caad1019b309296a ON applicant (applicant_type_id)');
}
}