<?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 Version20190530222040 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 ext_log_entries (id INT AUTO_INCREMENT NOT NULL, action VARCHAR(8) NOT NULL, logged_at DATETIME NOT NULL, object_id VARCHAR(64) DEFAULT NULL, object_class VARCHAR(255) NOT NULL, version INT NOT NULL, data LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', username VARCHAR(255) DEFAULT NULL, INDEX log_class_lookup_idx (object_class), INDEX log_date_lookup_idx (logged_at), INDEX log_user_lookup_idx (username), INDEX log_version_lookup_idx (object_id, object_class, version), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB ROW_FORMAT = DYNAMIC');
$this->addSql('ALTER TABLE organization_unit ADD created_by INT DEFAULT NULL, ADD updated_by INT DEFAULT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE organization_unit ADD CONSTRAINT FK_E5B232CEDE12AB56 FOREIGN KEY (created_by) REFERENCES fos_user (id)');
$this->addSql('ALTER TABLE organization_unit ADD CONSTRAINT FK_E5B232CE16FE72E1 FOREIGN KEY (updated_by) REFERENCES fos_user (id)');
$this->addSql('CREATE INDEX IDX_E5B232CEDE12AB56 ON organization_unit (created_by)');
$this->addSql('CREATE INDEX IDX_E5B232CE16FE72E1 ON organization_unit (updated_by)');
$this->addSql('ALTER TABLE fos_user ADD created_by INT DEFAULT NULL, ADD updated_by INT DEFAULT NULL, ADD first_name VARCHAR(255) DEFAULT NULL, ADD last_name VARCHAR(255) DEFAULT NULL, ADD telephone VARCHAR(255) DEFAULT NULL, ADD additional_notes LONGTEXT DEFAULT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL');
$this->addSql('ALTER TABLE fos_user ADD CONSTRAINT FK_957A6479DE12AB56 FOREIGN KEY (created_by) REFERENCES fos_user (id)');
$this->addSql('ALTER TABLE fos_user ADD CONSTRAINT FK_957A647916FE72E1 FOREIGN KEY (updated_by) REFERENCES fos_user (id)');
$this->addSql('CREATE INDEX IDX_957A6479DE12AB56 ON fos_user (created_by)');
$this->addSql('CREATE INDEX IDX_957A647916FE72E1 ON fos_user (updated_by)');
}
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('DROP TABLE ext_log_entries');
$this->addSql('ALTER TABLE fos_user DROP FOREIGN KEY FK_957A6479DE12AB56');
$this->addSql('ALTER TABLE fos_user DROP FOREIGN KEY FK_957A647916FE72E1');
$this->addSql('DROP INDEX IDX_957A6479DE12AB56 ON fos_user');
$this->addSql('DROP INDEX IDX_957A647916FE72E1 ON fos_user');
$this->addSql('ALTER TABLE fos_user DROP created_by, DROP updated_by, DROP first_name, DROP last_name, DROP telephone, DROP additional_notes, DROP created_at, DROP updated_at');
$this->addSql('ALTER TABLE organization_unit DROP FOREIGN KEY FK_E5B232CEDE12AB56');
$this->addSql('ALTER TABLE organization_unit DROP FOREIGN KEY FK_E5B232CE16FE72E1');
$this->addSql('DROP INDEX IDX_E5B232CEDE12AB56 ON organization_unit');
$this->addSql('DROP INDEX IDX_E5B232CE16FE72E1 ON organization_unit');
$this->addSql('ALTER TABLE organization_unit DROP created_by, DROP updated_by, DROP created_at, DROP updated_at');
}
}