<?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 Version20210806114949 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('ALTER TABLE company DROP FOREIGN KEY FK_4FBF094F67B3B43D');
$this->addSql('DROP INDEX IDX_4FBF094F67B3B43D ON company');
$this->addSql('ALTER TABLE company DROP users_id');
$this->addSql('ALTER TABLE user ADD company_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('CREATE INDEX IDX_8D93D649979B1AD6 ON user (company_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE company ADD users_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE company ADD CONSTRAINT FK_4FBF094F67B3B43D FOREIGN KEY (users_id) REFERENCES user (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_4FBF094F67B3B43D ON company (users_id)');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649979B1AD6');
$this->addSql('DROP INDEX IDX_8D93D649979B1AD6 ON user');
$this->addSql('ALTER TABLE user DROP company_id');
}
}