<?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 Version20240315095349 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, small_picture_id INT DEFAULT NULL, picture_id INT DEFAULT NULL, large_picture_id INT DEFAULT NULL, title VARCHAR(255) DEFAULT NULL, category_name VARCHAR(255) DEFAULT NULL, short_description VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, start_at DATETIME DEFAULT NULL, end_at DATETIME DEFAULT NULL, homepage TINYINT(1) DEFAULT 1 NOT NULL, active TINYINT(1) DEFAULT 1 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_23A0E66EA6FAB09 (small_picture_id), INDEX IDX_23A0E66EE45BDBF (picture_id), INDEX IDX_23A0E66A7E4C7CC (large_picture_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE article ADD CONSTRAINT FK_23A0E66EA6FAB09 FOREIGN KEY (small_picture_id) REFERENCES media_object (id)');
$this->addSql('ALTER TABLE article ADD CONSTRAINT FK_23A0E66EE45BDBF FOREIGN KEY (picture_id) REFERENCES media_object (id)');
$this->addSql('ALTER TABLE article ADD CONSTRAINT FK_23A0E66A7E4C7CC FOREIGN KEY (large_picture_id) REFERENCES media_object (id)');
$this->addSql('ALTER TABLE answer CHANGE rank rank INT DEFAULT 999 NOT NULL');
}
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_23A0E66EA6FAB09');
$this->addSql('ALTER TABLE article DROP FOREIGN KEY FK_23A0E66EE45BDBF');
$this->addSql('ALTER TABLE article DROP FOREIGN KEY FK_23A0E66A7E4C7CC');
$this->addSql('DROP TABLE article');
$this->addSql('ALTER TABLE answer CHANGE rank rank INT NOT NULL');
}
}