migrations/Version20230515121445.php line 1
<?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 Version20230515121445 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 site DROP CONSTRAINT fk_694309e4fdff2e92');
$this->addSql('DROP INDEX uniq_694309e4fdff2e92');
$this->addSql('ALTER TABLE site RENAME COLUMN thumbnail_id TO creator_id');
$this->addSql('ALTER TABLE site ADD CONSTRAINT FK_694309E461220EA6 FOREIGN KEY (creator_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_694309E461220EA6 ON site (creator_id)');
$this->addSql('ALTER TABLE "user" DROP CONSTRAINT fk_8d93d649f6bd1646');
$this->addSql('DROP INDEX uniq_8d93d649f6bd1646');
$this->addSql('ALTER TABLE "user" DROP site_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE site DROP CONSTRAINT FK_694309E461220EA6');
$this->addSql('DROP INDEX IDX_694309E461220EA6');
$this->addSql('ALTER TABLE site RENAME COLUMN creator_id TO thumbnail_id');
$this->addSql('ALTER TABLE site ADD CONSTRAINT fk_694309e4fdff2e92 FOREIGN KEY (thumbnail_id) REFERENCES resource (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE UNIQUE INDEX uniq_694309e4fdff2e92 ON site (thumbnail_id)');
$this->addSql('ALTER TABLE "user" ADD site_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE "user" ADD CONSTRAINT fk_8d93d649f6bd1646 FOREIGN KEY (site_id) REFERENCES site (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE UNIQUE INDEX uniq_8d93d649f6bd1646 ON "user" (site_id)');
}
}