<?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 Version20231114155732 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 source (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', utm_source VARCHAR(255) DEFAULT NULL, color VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, modified_at DATETIME NOT NULL, INDEX idx_name (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE user ADD source_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649953C1C61 FOREIGN KEY (source_id) REFERENCES source (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_8D93D649953C1C61 ON user (source_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649953C1C61');
$this->addSql('DROP TABLE source');
$this->addSql('DROP INDEX IDX_8D93D649953C1C61 ON user');
$this->addSql('ALTER TABLE user DROP source_id');
}
}