<?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 Version20210805133113 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 accent (id VARCHAR(255) NOT NULL, display VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('INSERT INTO accent(id, display) VALUES ("belgique_belge", "Belgium / Belgian")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("antilles_caribeen", "West Indies / Caribbean, (Guadeloupe, Martinique)")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("suisse_suisse", "Switzerland / Switzerland")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_paris", "France / Paris, center")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_est", "France / East (Savoie)")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_nord", "France / North")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_magrebin", "France / Magrebin")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_nord_est", "France / North-East (Alsace)")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_midi", "France / Midi")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_sud_est", "France / South East (Marseille)")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_sud_ouest", "France / South-West (Toulouse)")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_ouest", "France / West")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("france_africain", "France / African")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("canada_acadien", "Canada / Acadian")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("canada_brayon", "Canada / Brayon")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("canada_metis", "Canada / Métis")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("canada_terre_neuve", "Canada / Newfoundland and Labrador")');
$this->addSql('INSERT INTO accent(id, display) VALUES ("canada_quebec", "Canada / Quebec")');
$this->addSql('CREATE TABLE accent_mapping (id INT AUTO_INCREMENT NOT NULL, project_id INT DEFAULT NULL, accent_id VARCHAR(255) DEFAULT NULL, active_man TINYINT(1) NOT NULL, active_women TINYINT(1) NOT NULL, INDEX IDX_37F2910E166D1F9C (project_id), INDEX IDX_37F2910E4A4D0C45 (accent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE project (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, note LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE accent_mapping ADD CONSTRAINT FK_37F2910E166D1F9C FOREIGN KEY (project_id) REFERENCES project (id)');
$this->addSql('ALTER TABLE accent_mapping ADD CONSTRAINT FK_37F2910E4A4D0C45 FOREIGN KEY (accent_id) REFERENCES accent (id)');
$this->addSql('ALTER TABLE record ADD project_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE record ADD CONSTRAINT FK_9B349F916761D2EB FOREIGN KEY (accent) REFERENCES accent (id)');
$this->addSql('ALTER TABLE record ADD CONSTRAINT FK_9B349F91166D1F9C FOREIGN KEY (project_id) REFERENCES project (id)');
$this->addSql('CREATE INDEX IDX_9B349F916761D2EB ON record (accent)');
$this->addSql('CREATE INDEX IDX_9B349F91166D1F9C ON record (project_id)');
$this->addSql('ALTER TABLE resource CHANGE accent accent VARCHAR(255) DEFAULT NULL, CHANGE accent_hidden accent_hidden VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE resource ADD CONSTRAINT FK_BC91F4166761D2EB FOREIGN KEY (accent) REFERENCES accent (id)');
$this->addSql('ALTER TABLE resource ADD CONSTRAINT FK_BC91F4162D9CD0B0 FOREIGN KEY (accent_hidden) REFERENCES accent (id)');
$this->addSql('CREATE INDEX IDX_BC91F4166761D2EB ON resource (accent)');
$this->addSql('CREATE INDEX IDX_BC91F4162D9CD0B0 ON resource (accent_hidden)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE accent_mapping DROP FOREIGN KEY FK_37F2910E4A4D0C45');
$this->addSql('ALTER TABLE record DROP FOREIGN KEY FK_9B349F916761D2EB');
$this->addSql('ALTER TABLE resource DROP FOREIGN KEY FK_BC91F4166761D2EB');
$this->addSql('ALTER TABLE resource DROP FOREIGN KEY FK_BC91F4162D9CD0B0');
$this->addSql('ALTER TABLE accent_mapping DROP FOREIGN KEY FK_37F2910E166D1F9C');
$this->addSql('ALTER TABLE record DROP FOREIGN KEY FK_9B349F91166D1F9C');
$this->addSql('DROP TABLE accent');
$this->addSql('DROP TABLE accent_mapping');
$this->addSql('DROP TABLE project');
$this->addSql('DROP INDEX IDX_9B349F916761D2EB ON record');
$this->addSql('DROP INDEX IDX_9B349F91166D1F9C ON record');
$this->addSql('ALTER TABLE record DROP project_id');
$this->addSql('DROP INDEX IDX_BC91F4166761D2EB ON resource');
$this->addSql('DROP INDEX IDX_BC91F4162D9CD0B0 ON resource');
$this->addSql('ALTER TABLE resource CHANGE accent accent VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE accent_hidden accent_hidden VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
}
}