<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20221212155747 extends AbstractMigration
{
public function getDescription(): string
{
return 'add new fields to mandate: period, exclusive duration , additional properties ';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE mandate ADD duration INT DEFAULT NULL');
$this->addSql('ALTER TABLE mandate ADD exclusive_duration INT DEFAULT NULL');
$this->addSql('ALTER TABLE property ADD mandate_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE property ADD CONSTRAINT FK_8BF21CDE6C1129CD FOREIGN KEY (mandate_id) REFERENCES mandate (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_8BF21CDE6C1129CD ON property (mandate_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE mandate DROP duration');
$this->addSql('ALTER TABLE mandate DROP exclusive_duration');
$this->addSql('ALTER TABLE property DROP CONSTRAINT FK_8BF21CDE6C1129CD');
$this->addSql('DROP INDEX IDX_8BF21CDE6C1129CD');
$this->addSql('ALTER TABLE property DROP mandate_id');
}
}