<?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 Version20190517173011 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 organization_unit (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 setting (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(128) NOT NULL, description VARCHAR(255) DEFAULT NULL, type VARCHAR(255) NOT NULL COMMENT \'(DC2Type:setting_type_enum)\', data LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', choices LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', domain_name VARCHAR(128) NOT NULL, domain_priority INT DEFAULT 0 NOT NULL, domain_enabled TINYINT(1) NOT NULL, domain_read_only TINYINT(1) DEFAULT \'0\' NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE fos_user (id INT AUTO_INCREMENT NOT NULL, organization_unit_id INT DEFAULT NULL, INDEX IDX_957A6479356FF84E (organization_unit_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE fos_user ADD CONSTRAINT FK_957A6479356FF84E FOREIGN KEY (organization_unit_id) REFERENCES organization_unit (id)');
}
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 fos_user DROP FOREIGN KEY FK_957A6479356FF84E');
$this->addSql('DROP TABLE organization_unit');
$this->addSql('DROP TABLE setting');
$this->addSql('DROP TABLE fos_user');
}
}