<?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 Version20220831153134 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 SEQUENCE department_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE department (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE employee ADD department_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE employee ALTER salary_type DROP DEFAULT');
$this->addSql('ALTER TABLE employee ADD CONSTRAINT FK_5D9F75A1AE80F5DF FOREIGN KEY (department_id) REFERENCES department (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_5D9F75A1AE80F5DF ON employee (department_id)');
}
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 employee DROP CONSTRAINT FK_5D9F75A1AE80F5DF');
$this->addSql('DROP SEQUENCE department_id_seq CASCADE');
$this->addSql('DROP TABLE department');
$this->addSql('DROP INDEX IDX_5D9F75A1AE80F5DF');
$this->addSql('ALTER TABLE employee DROP department_id');
$this->addSql('ALTER TABLE employee ALTER salary_type SET DEFAULT \'O\'');
$this->addSql('ALTER TABLE "user" DROP CONSTRAINT FK_8D93D6498C03F15C');
$this->addSql('DROP INDEX UNIQ_8D93D649E7927C74');
$this->addSql('DROP INDEX UNIQ_8D93D6498C03F15C');
$this->addSql('DROP INDEX "primary"');
}
}