<?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 Version20220419132503 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 department (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE department_position_rel (department_id INT NOT NULL, position_id INT NOT NULL, PRIMARY KEY(department_id, position_id))');
$this->addSql('CREATE INDEX IDX_FB71BD67AE80F5DF ON department_position_rel (department_id)');
$this->addSql('CREATE INDEX IDX_FB71BD67DD842E46 ON department_position_rel (position_id)');
$this->addSql('CREATE TABLE position (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE department_position_rel ADD CONSTRAINT FK_FB71BD67AE80F5DF FOREIGN KEY (department_id) REFERENCES department (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE department_position_rel ADD CONSTRAINT FK_FB71BD67DD842E46 FOREIGN KEY (position_id) REFERENCES position (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
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('ALTER TABLE department_position_rel DROP CONSTRAINT FK_FB71BD67AE80F5DF');
$this->addSql('ALTER TABLE department_position_rel DROP CONSTRAINT FK_FB71BD67DD842E46');
$this->addSql('DROP TABLE department');
$this->addSql('DROP TABLE department_position_rel');
$this->addSql('DROP TABLE position');
}
}