<?php
declare(strict_types=1);
namespace Application\Migrations;
use App\Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20211214114350 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE legal_entity_contract ADD lead_registrant_id INT DEFAULT NULL, ADD notification_sent DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', ADD remarks LONGTEXT DEFAULT NULL, ADD signatory_name LONGTEXT DEFAULT NULL, ADD signatory_job LONGTEXT DEFAULT NULL');
$this->addSql('ALTER TABLE legal_entity_contract ADD CONSTRAINT FK_465E8549E667FC FOREIGN KEY (lead_registrant_id) REFERENCES lead_registrant (id)');
$this->addSql('CREATE INDEX IDX_465E8549E667FC ON legal_entity_contract (lead_registrant_id)');
$this->addSql('INSERT INTO legal_entity_contract (lead_registrant_id, accepted_by_id, accepted, accepted_ip, accepted_at, notification_sent, remarks, signatory_name, signatory_job, created_at, updated_at, file_name, file_path, file_mime_type, file_size, file_timestamp, dtype, acceptance_required, force_acceptance, `type`) SELECT lead_registrant_id, accepted_by_id, accepted, accepted_ip, accepted_at, notification_sent, remarks, signatory_name, signatory_job, created_at, updated_at, file_name, file_path, file_mime_type, file_size, file_timestamp, "agreement", false, false, "lead-registrant" FROM lead_registrant_agreement');
$this
->addCommand(['app:fix:sief-853']);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE legal_entity_contract DROP FOREIGN KEY FK_465E8549E667FC');
$this->addSql('DROP INDEX IDX_465E8549E667FC ON legal_entity_contract');
$this->addSql('ALTER TABLE legal_entity_contract DROP lead_registrant_id, DROP notification_sent, DROP remarks, DROP signatory_name, DROP signatory_job');
}
}