<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240912083441 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE bopartner_profile_contact_mapping (id INT AUTO_INCREMENT NOT NULL, bopartner_profile_id INT DEFAULT NULL, contact_id INT DEFAULT NULL, position INT NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_6C430CCB731CCFFD (bopartner_profile_id), INDEX IDX_6C430CCBE7A1254A (contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE company_profile_contact_mapping (id INT AUTO_INCREMENT NOT NULL, company_profile_id INT DEFAULT NULL, contact_id INT DEFAULT NULL, position INT NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_81A4D8587174FB2E (company_profile_id), INDEX IDX_81A4D858E7A1254A (contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE school_profile_contact_mapping (id INT AUTO_INCREMENT NOT NULL, school_profile_id INT DEFAULT NULL, contact_id INT DEFAULT NULL, position INT NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_FCA605EC795B924A (school_profile_id), INDEX IDX_FCA605ECE7A1254A (contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE bopartner_profile_contact_mapping ADD CONSTRAINT FK_6C430CCB731CCFFD FOREIGN KEY (bopartner_profile_id) REFERENCES bopartner_profile (id)');
$this->addSql('ALTER TABLE bopartner_profile_contact_mapping ADD CONSTRAINT FK_6C430CCBE7A1254A FOREIGN KEY (contact_id) REFERENCES contact (id)');
$this->addSql('ALTER TABLE company_profile_contact_mapping ADD CONSTRAINT FK_81A4D8587174FB2E FOREIGN KEY (company_profile_id) REFERENCES company_profile (id)');
$this->addSql('ALTER TABLE company_profile_contact_mapping ADD CONSTRAINT FK_81A4D858E7A1254A FOREIGN KEY (contact_id) REFERENCES contact (id)');
$this->addSql('ALTER TABLE school_profile_contact_mapping ADD CONSTRAINT FK_FCA605EC795B924A FOREIGN KEY (school_profile_id) REFERENCES school_profile (id)');
$this->addSql('ALTER TABLE school_profile_contact_mapping ADD CONSTRAINT FK_FCA605ECE7A1254A FOREIGN KEY (contact_id) REFERENCES contact (id)');
$this->addSql('ALTER TABLE school_contact DROP FOREIGN KEY FK_DE4DD4A01C2D1E0C');
$this->addSql('ALTER TABLE school_contact DROP FOREIGN KEY FK_DE4DD4A0795B924A');
$this->addSql('ALTER TABLE school_contact DROP FOREIGN KEY FK_DE4DD4A0217BBB47');
$this->addSql('ALTER TABLE school_contact DROP FOREIGN KEY FK_DE4DD4A0292E8AE2');
$this->addSql('ALTER TABLE bopartner_contact DROP FOREIGN KEY FK_85C65A0B292E8AE2');
$this->addSql('ALTER TABLE bopartner_contact DROP FOREIGN KEY FK_85C65A0B1C2D1E0C');
$this->addSql('ALTER TABLE bopartner_contact DROP FOREIGN KEY FK_85C65A0B731CCFFD');
$this->addSql('ALTER TABLE bopartner_contact DROP FOREIGN KEY FK_85C65A0B217BBB47');
$this->addSql('ALTER TABLE company_contact DROP FOREIGN KEY FK_6C30FCEF217BBB47');
$this->addSql('ALTER TABLE company_contact DROP FOREIGN KEY FK_6C30FCEF292E8AE2');
$this->addSql('ALTER TABLE company_contact DROP FOREIGN KEY FK_6C30FCEF1C2D1E0C');
$this->addSql('ALTER TABLE company_contact DROP FOREIGN KEY FK_6C30FCEF7174FB2E');
$this->addSql('DROP TABLE school_contact');
$this->addSql('DROP TABLE bopartner_contact');
$this->addSql('DROP TABLE company_contact');
$this->addSql('ALTER TABLE contact DROP FOREIGN KEY FK_4C62E63816F2520F');
$this->addSql('DROP INDEX IDX_4C62E63816F2520F ON contact');
$this->addSql('ALTER TABLE contact DROP profile_type_id, DROP profile_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE school_contact (id INT AUTO_INCREMENT NOT NULL, person_id INT DEFAULT NULL, communication_id INT DEFAULT NULL, profile_picture_id INT DEFAULT NULL, school_profile_id INT DEFAULT NULL, employee_position VARCHAR(128) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_DE4DD4A01C2D1E0C (communication_id), INDEX IDX_DE4DD4A0292E8AE2 (profile_picture_id), INDEX IDX_DE4DD4A0795B924A (school_profile_id), UNIQUE INDEX UNIQ_DE4DD4A0217BBB47 (person_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE bopartner_contact (id INT AUTO_INCREMENT NOT NULL, person_id INT DEFAULT NULL, communication_id INT DEFAULT NULL, profile_picture_id INT DEFAULT NULL, bopartner_profile_id INT DEFAULT NULL, employee_position VARCHAR(128) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL, INDEX IDX_85C65A0B292E8AE2 (profile_picture_id), INDEX IDX_85C65A0B731CCFFD (bopartner_profile_id), UNIQUE INDEX UNIQ_85C65A0B217BBB47 (person_id), UNIQUE INDEX UNIQ_85C65A0B1C2D1E0C (communication_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE company_contact (id INT AUTO_INCREMENT NOT NULL, person_id INT DEFAULT NULL, communication_id INT DEFAULT NULL, profile_picture_id INT DEFAULT NULL, company_profile_id INT DEFAULT NULL, employee_position VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL, INDEX IDX_6C30FCEF292E8AE2 (profile_picture_id), INDEX IDX_6C30FCEF7174FB2E (company_profile_id), UNIQUE INDEX UNIQ_6C30FCEF217BBB47 (person_id), UNIQUE INDEX UNIQ_6C30FCEF1C2D1E0C (communication_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE school_contact ADD CONSTRAINT FK_DE4DD4A01C2D1E0C FOREIGN KEY (communication_id) REFERENCES communication (id)');
$this->addSql('ALTER TABLE school_contact ADD CONSTRAINT FK_DE4DD4A0795B924A FOREIGN KEY (school_profile_id) REFERENCES school_profile (id)');
$this->addSql('ALTER TABLE school_contact ADD CONSTRAINT FK_DE4DD4A0217BBB47 FOREIGN KEY (person_id) REFERENCES person (id)');
$this->addSql('ALTER TABLE school_contact ADD CONSTRAINT FK_DE4DD4A0292E8AE2 FOREIGN KEY (profile_picture_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE bopartner_contact ADD CONSTRAINT FK_85C65A0B292E8AE2 FOREIGN KEY (profile_picture_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE bopartner_contact ADD CONSTRAINT FK_85C65A0B1C2D1E0C FOREIGN KEY (communication_id) REFERENCES communication (id)');
$this->addSql('ALTER TABLE bopartner_contact ADD CONSTRAINT FK_85C65A0B731CCFFD FOREIGN KEY (bopartner_profile_id) REFERENCES bopartner_profile (id)');
$this->addSql('ALTER TABLE bopartner_contact ADD CONSTRAINT FK_85C65A0B217BBB47 FOREIGN KEY (person_id) REFERENCES person (id)');
$this->addSql('ALTER TABLE company_contact ADD CONSTRAINT FK_6C30FCEF217BBB47 FOREIGN KEY (person_id) REFERENCES person (id)');
$this->addSql('ALTER TABLE company_contact ADD CONSTRAINT FK_6C30FCEF292E8AE2 FOREIGN KEY (profile_picture_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE company_contact ADD CONSTRAINT FK_6C30FCEF1C2D1E0C FOREIGN KEY (communication_id) REFERENCES communication (id)');
$this->addSql('ALTER TABLE company_contact ADD CONSTRAINT FK_6C30FCEF7174FB2E FOREIGN KEY (company_profile_id) REFERENCES company_profile (id)');
$this->addSql('ALTER TABLE bopartner_profile_contact_mapping DROP FOREIGN KEY FK_6C430CCB731CCFFD');
$this->addSql('ALTER TABLE bopartner_profile_contact_mapping DROP FOREIGN KEY FK_6C430CCBE7A1254A');
$this->addSql('ALTER TABLE company_profile_contact_mapping DROP FOREIGN KEY FK_81A4D8587174FB2E');
$this->addSql('ALTER TABLE company_profile_contact_mapping DROP FOREIGN KEY FK_81A4D858E7A1254A');
$this->addSql('ALTER TABLE school_profile_contact_mapping DROP FOREIGN KEY FK_FCA605EC795B924A');
$this->addSql('ALTER TABLE school_profile_contact_mapping DROP FOREIGN KEY FK_FCA605ECE7A1254A');
$this->addSql('DROP TABLE bopartner_profile_contact_mapping');
$this->addSql('DROP TABLE company_profile_contact_mapping');
$this->addSql('DROP TABLE school_profile_contact_mapping');
$this->addSql('ALTER TABLE contact ADD profile_type_id INT DEFAULT NULL, ADD profile_id VARCHAR(20) NOT NULL');
$this->addSql('ALTER TABLE contact ADD CONSTRAINT FK_4C62E63816F2520F FOREIGN KEY (profile_type_id) REFERENCES profile_type (id)');
$this->addSql('CREATE INDEX IDX_4C62E63816F2520F ON contact (profile_type_id)');
}
}