<?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 Version20241105105721 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 article (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', title LONGTEXT NOT NULL, status TINYINT(1) NOT NULL, media_type LONGTEXT DEFAULT NULL, poi_type CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', entity_type VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_23A0E66D17F50A6 (uuid), INDEX IDX_23A0E66EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE article_locale (id INT AUTO_INCREMENT NOT NULL, article_id INT DEFAULT NULL, locale_id INT DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', url VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_2B475118D17F50A6 (uuid), UNIQUE INDEX UNIQ_2B475118F47645AE (url), INDEX IDX_2B4751187294869C (article_id), INDEX IDX_2B475118E559DFD1 (locale_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE article ADD CONSTRAINT FK_23A0E66EA9FDD75 FOREIGN KEY (media_id) REFERENCES media (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE article_locale ADD CONSTRAINT FK_2B4751187294869C FOREIGN KEY (article_id) REFERENCES article (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE article_locale ADD CONSTRAINT FK_2B475118E559DFD1 FOREIGN KEY (locale_id) REFERENCES locale (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE article DROP FOREIGN KEY FK_23A0E66EA9FDD75');
$this->addSql('ALTER TABLE article_locale DROP FOREIGN KEY FK_2B4751187294869C');
$this->addSql('ALTER TABLE article_locale DROP FOREIGN KEY FK_2B475118E559DFD1');
$this->addSql('DROP TABLE article');
$this->addSql('DROP TABLE article_locale');
}
}