<?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 Version20221115115138 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 property_agent (property_id INT NOT NULL, agent_id INT NOT NULL, PRIMARY KEY(property_id, agent_id))');
$this->addSql('CREATE INDEX IDX_E0985D90549213EC ON property_agent (property_id)');
$this->addSql('CREATE INDEX IDX_E0985D903414710B ON property_agent (agent_id)');
$this->addSql('ALTER TABLE property_agent ADD CONSTRAINT FK_E0985D90549213EC FOREIGN KEY (property_id) REFERENCES property (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE property_agent ADD CONSTRAINT FK_E0985D903414710B FOREIGN KEY (agent_id) REFERENCES agent (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE property ADD is_shared BOOLEAN DEFAULT false');
}
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('DROP TABLE property_agent');
$this->addSql('ALTER TABLE property DROP is_shared');
}
}