<?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 Version20220222215557 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 game_server (id INT AUTO_INCREMENT NOT NULL, server_id INT NOT NULL, country_group_id INT DEFAULT NULL, path LONGTEXT NOT NULL, active TINYINT(1) NOT NULL, INDEX IDX_2758783E1844E6B7 (server_id), INDEX IDX_2758783ECD9E88FA (country_group_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE server (id INT AUTO_INCREMENT NOT NULL, hostname VARCHAR(255) NOT NULL, login VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE game_server ADD CONSTRAINT FK_2758783E1844E6B7 FOREIGN KEY (server_id) REFERENCES server (id)');
$this->addSql('ALTER TABLE game_server ADD CONSTRAINT FK_2758783ECD9E88FA FOREIGN KEY (country_group_id) REFERENCES country_group (id)');
$this->addSql('ALTER TABLE lap_time ADD stracker_identifier VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE user ADD country_id INT DEFAULT NULL, ADD steam_id VARCHAR(255) DEFAULT NULL, ADD discord_id VARCHAR(255) DEFAULT NULL, ADD discord_username VARCHAR(255) DEFAULT NULL, ADD created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649F92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
$this->addSql('CREATE INDEX IDX_8D93D649F92F3E70 ON user (country_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE game_server DROP FOREIGN KEY FK_2758783E1844E6B7');
$this->addSql('DROP TABLE game_server');
$this->addSql('DROP TABLE server');
$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 country 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 country_group CHANGE name name VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE identifier identifier VARCHAR(5) NOT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE lap_time DROP stracker_identifier, CHANGE laptime laptime VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE sector1 sector1 VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE sector2 sector2 VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE sector3 sector3 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 DROP FOREIGN KEY FK_8D93D649F92F3E70');
$this->addSql('DROP INDEX IDX_8D93D649F92F3E70 ON user');
$this->addSql('ALTER TABLE user DROP country_id, DROP steam_id, DROP discord_id, DROP discord_username, DROP created_at, CHANGE email email VARCHAR(180) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE roles roles LONGTEXT NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:json)\'');
}
}