<?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 Version20191104110853 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE access (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, reference_person_id INT DEFAULT NULL, motivo_di_ingresso LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_6692B54A76ED395 (user_id), INDEX IDX_6692B54E119DDB1 (reference_person_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE company_group (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE reference_person (id INT AUTO_INCREMENT NOT NULL, company_group_id INT NOT NULL, name VARCHAR(255) NOT NULL, surname VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_29BD6072E6C3CC2A (company_group_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE access ADD CONSTRAINT FK_6692B54A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE access ADD CONSTRAINT FK_6692B54E119DDB1 FOREIGN KEY (reference_person_id) REFERENCES reference_person (id)');
$this->addSql('ALTER TABLE reference_person ADD CONSTRAINT FK_29BD6072E6C3CC2A FOREIGN KEY (company_group_id) REFERENCES company_group (id)');
$this->addSql('ALTER TABLE user CHANGE company_supplier_id company_supplier_id INT DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE reference_person DROP FOREIGN KEY FK_29BD6072E6C3CC2A');
$this->addSql('ALTER TABLE access DROP FOREIGN KEY FK_6692B54E119DDB1');
$this->addSql('DROP TABLE access');
$this->addSql('DROP TABLE company_group');
$this->addSql('DROP TABLE reference_person');
$this->addSql('ALTER TABLE user CHANGE company_supplier_id company_supplier_id INT DEFAULT NULL');
}
}