<?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 Version20210915131639 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 chat_message (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, message LONGTEXT NOT NULL, date DATETIME NOT NULL, `read` TINYINT(1) DEFAULT \'0\' NOT NULL, scenario_id INT DEFAULT NULL, INDEX IDX_FAB3FC16E04E49DF (scenario_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE lang (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('CREATE TABLE scenario (id INT AUTO_INCREMENT NOT NULL, ressource1_id INT DEFAULT NULL, ressource2_id INT DEFAULT NULL, scenario_type_id INT DEFAULT NULL, phone1 VARCHAR(255) DEFAULT NULL, phone2 VARCHAR(255) DEFAULT NULL, voice1 LONGTEXT DEFAULT NULL, voice2 LONGTEXT DEFAULT NULL, pin1 VARCHAR(255) DEFAULT NULL, pin2 VARCHAR(255) DEFAULT NULL, call_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_3E45C8D8D2B8890 (ressource1_id), UNIQUE INDEX UNIQ_3E45C8D81F9E277E (ressource2_id), INDEX IDX_3E45C8D8DA8A4C93 (scenario_type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE scenario_type (id INT AUTO_INCREMENT NOT NULL, lang_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, brief_client LONGTEXT NOT NULL, brief_agent LONGTEXT NOT NULL, INDEX IDX_EC138115B213FA4 (lang_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE scenario ADD CONSTRAINT FK_3E45C8D8D2B8890 FOREIGN KEY (ressource1_id) REFERENCES resource (id)');
$this->addSql('ALTER TABLE scenario ADD CONSTRAINT FK_3E45C8D81F9E277E FOREIGN KEY (ressource2_id) REFERENCES resource (id)');
$this->addSql('ALTER TABLE scenario ADD CONSTRAINT FK_3E45C8D8DA8A4C93 FOREIGN KEY (scenario_type_id) REFERENCES scenario_type (id)');
$this->addSql('ALTER TABLE scenario_type ADD CONSTRAINT FK_EC138115B213FA4 FOREIGN KEY (lang_id) REFERENCES lang (id)');
$this->addSql('ALTER TABLE accent ADD country_id INT DEFAULT NULL, ADD lang_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE accent ADD CONSTRAINT FK_6761D2EBF92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
$this->addSql('ALTER TABLE accent ADD CONSTRAINT FK_6761D2EBB213FA4 FOREIGN KEY (lang_id) REFERENCES lang (id)');
$this->addSql('CREATE INDEX IDX_6761D2EBF92F3E70 ON accent (country_id)');
$this->addSql('CREATE INDEX IDX_6761D2EBB213FA4 ON accent (lang_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE accent DROP FOREIGN KEY FK_6761D2EBB213FA4');
$this->addSql('ALTER TABLE scenario_type DROP FOREIGN KEY FK_EC138115B213FA4');
$this->addSql('ALTER TABLE scenario DROP FOREIGN KEY FK_3E45C8D8DA8A4C93');
$this->addSql('DROP TABLE chat_message');
$this->addSql('DROP TABLE lang');
$this->addSql('DROP TABLE scenario');
$this->addSql('DROP TABLE scenario_type');
$this->addSql('ALTER TABLE accent DROP FOREIGN KEY FK_6761D2EBF92F3E70');
$this->addSql('DROP INDEX IDX_6761D2EBF92F3E70 ON accent');
$this->addSql('DROP INDEX IDX_6761D2EBB213FA4 ON accent');
$this->addSql('ALTER TABLE accent DROP country_id, DROP lang_id');
}
}