<?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 Version20220516030615 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 domains (id INT AUTO_INCREMENT NOT NULL, label VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE formations_sessions (id INT AUTO_INCREMENT NOT NULL, formation_id INT DEFAULT NULL, label VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, starting_date DATE DEFAULT NULL, end_date DATE DEFAULT NULL, is_enabled TINYINT(1) DEFAULT NULL, INDEX IDX_2BBC6BF05200282E (formation_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE registrations_status (id INT AUTO_INCREMENT NOT NULL, icon_id INT DEFAULT NULL, label VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, color VARCHAR(255) DEFAULT NULL, is_enabled TINYINT(1) DEFAULT NULL, outgoing_message LONGTEXT DEFAULT NULL, incoming_message LONGTEXT DEFAULT NULL, is_initial_status TINYINT(1) DEFAULT NULL, is_final_status TINYINT(1) DEFAULT NULL, incoming_recipient VARCHAR(255) DEFAULT NULL, incoming_cc VARCHAR(255) DEFAULT NULL, incoming_cci LONGTEXT DEFAULT NULL, outgoing_cc LONGTEXT DEFAULT NULL, outgoing_cci LONGTEXT DEFAULT NULL, UNIQUE INDEX UNIQ_6C9BA02054B9D732 (icon_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE formations_sessions ADD CONSTRAINT FK_2BBC6BF05200282E FOREIGN KEY (formation_id) REFERENCES formations (id)');
$this->addSql('ALTER TABLE registrations_status ADD CONSTRAINT FK_6C9BA02054B9D732 FOREIGN KEY (icon_id) REFERENCES picture (id)');
$this->addSql('ALTER TABLE formations_thematics ADD domain_id INT DEFAULT NULL, ADD details LONGTEXT DEFAULT NULL, ADD target LONGTEXT DEFAULT NULL, ADD duration VARCHAR(255) DEFAULT NULL, ADD cost VARCHAR(255) DEFAULT NULL, ADD main_objective LONGTEXT DEFAULT NULL, ADD specifics_objectives LONGTEXT DEFAULT NULL');
$this->addSql('ALTER TABLE formations_thematics ADD CONSTRAINT FK_9CCBACF0115F0EE5 FOREIGN KEY (domain_id) REFERENCES domains (id)');
$this->addSql('CREATE INDEX IDX_9CCBACF0115F0EE5 ON formations_thematics (domain_id)');
$this->addSql('ALTER TABLE registrations ADD session_id INT DEFAULT NULL, ADD status_id INT DEFAULT NULL, ADD closing_date DATETIME DEFAULT NULL, ADD code VARCHAR(255) DEFAULT NULL, ADD ip VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE registrations ADD CONSTRAINT FK_53DE51E7613FECDF FOREIGN KEY (session_id) REFERENCES formations_sessions (id)');
$this->addSql('ALTER TABLE registrations ADD CONSTRAINT FK_53DE51E76BF700BD FOREIGN KEY (status_id) REFERENCES registrations_status (id)');
$this->addSql('CREATE INDEX IDX_53DE51E7613FECDF ON registrations (session_id)');
$this->addSql('CREATE INDEX IDX_53DE51E76BF700BD ON registrations (status_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE formations_thematics DROP FOREIGN KEY FK_9CCBACF0115F0EE5');
$this->addSql('ALTER TABLE registrations DROP FOREIGN KEY FK_53DE51E7613FECDF');
$this->addSql('ALTER TABLE registrations DROP FOREIGN KEY FK_53DE51E76BF700BD');
$this->addSql('DROP TABLE domains');
$this->addSql('DROP TABLE formations_sessions');
$this->addSql('DROP TABLE registrations_status');
$this->addSql('DROP INDEX IDX_9CCBACF0115F0EE5 ON formations_thematics');
$this->addSql('ALTER TABLE formations_thematics DROP domain_id, DROP details, DROP target, DROP duration, DROP cost, DROP main_objective, DROP specifics_objectives');
$this->addSql('DROP INDEX IDX_53DE51E7613FECDF ON registrations');
$this->addSql('DROP INDEX IDX_53DE51E76BF700BD ON registrations');
$this->addSql('ALTER TABLE registrations DROP session_id, DROP status_id, DROP closing_date, DROP code, DROP ip');
}
}