<?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 Version20230308203645 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 target_url (id INT AUTO_INCREMENT NOT NULL, url VARCHAR(2048) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE targets ADD target_url_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE targets ADD CONSTRAINT FK_AF431E1388C53D57 FOREIGN KEY (target_url_id) REFERENCES target_url (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_AF431E1388C53D57 ON targets (target_url_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE targets DROP FOREIGN KEY FK_AF431E1388C53D57');
$this->addSql('DROP TABLE target_url');
$this->addSql('DROP INDEX UNIQ_AF431E1388C53D57 ON targets');
$this->addSql('ALTER TABLE targets DROP target_url_id');
}
}