api/src/Migrations/Version20210719135646.php
<?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 Version20210719135646 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE editorial (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, text VARCHAR(512) NOT NULL, label VARCHAR(255) NOT NULL, link VARCHAR(255) NOT NULL, status SMALLINT NOT NULL, created_date DATETIME NOT NULL, updated_date DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE image ADD editorial_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045FBAF1A24D FOREIGN KEY (editorial_id) REFERENCES editorial (id)');
$this->addSql('CREATE INDEX IDX_C53D045FBAF1A24D ON image (editorial_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045FBAF1A24D');
$this->addSql('DROP TABLE editorial');
$this->addSql('DROP INDEX IDX_C53D045FBAF1A24D ON image');
$this->addSql('ALTER TABLE image DROP editorial_id');
}
}