<?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 Version20201228204104 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE lot ADD category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE lot ADD CONSTRAINT FK_B81291B12469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
$this->addSql('CREATE INDEX IDX_B81291B12469DE2 ON lot (category_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE lot DROP FOREIGN KEY FK_B81291B12469DE2');
$this->addSql('DROP TABLE category');
$this->addSql('DROP INDEX IDX_B81291B12469DE2 ON lot');
$this->addSql('ALTER TABLE lot DROP category_id');
}
}