<?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 Version20220208220859 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 country (id INT AUTO_INCREMENT NOT NULL, country_group_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, identifier VARCHAR(255) NOT NULL, INDEX IDX_5373C966CD9E88FA (country_group_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE country_group (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, identifier VARCHAR(5) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE lap_time (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, laptime VARCHAR(255) NOT NULL, sector1 VARCHAR(255) NOT NULL, sector2 VARCHAR(255) NOT NULL, sector3 VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_30163F4EA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE registered (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, car_id INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_4BFEE160A76ED395 (user_id), INDEX IDX_4BFEE160C3C6F69F (car_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE country ADD CONSTRAINT FK_5373C966CD9E88FA FOREIGN KEY (country_group_id) REFERENCES country_group (id)');
$this->addSql('ALTER TABLE lap_time ADD CONSTRAINT FK_30163F4EA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE registered ADD CONSTRAINT FK_4BFEE160A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE registered ADD CONSTRAINT FK_4BFEE160C3C6F69F FOREIGN KEY (car_id) REFERENCES car (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE country DROP FOREIGN KEY FK_5373C966CD9E88FA');
$this->addSql('DROP TABLE country');
$this->addSql('DROP TABLE country_group');
$this->addSql('DROP TABLE lap_time');
$this->addSql('DROP TABLE registered');
$this->addSql('ALTER TABLE car CHANGE name name VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE identifier identifier VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE messenger_messages CHANGE body body LONGTEXT NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE headers headers LONGTEXT NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE queue_name queue_name VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE user CHANGE email email VARCHAR(180) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE roles roles LONGTEXT NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:json)\'');
}
}