<?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 Version20210910082100 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 race (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, car_img VARCHAR(255) DEFAULT NULL, technical_file VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE line_table ADD race_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE line_table ADD CONSTRAINT FK_9ADA8C56E59D40D FOREIGN KEY (race_id) REFERENCES race (id)');
$this->addSql('CREATE INDEX IDX_9ADA8C56E59D40D ON line_table (race_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE line_table DROP FOREIGN KEY FK_9ADA8C56E59D40D');
$this->addSql('DROP TABLE race');
$this->addSql('DROP INDEX IDX_9ADA8C56E59D40D ON line_table');
$this->addSql('ALTER TABLE line_table DROP race_id');
}
}