migrations/Version20190517173011.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20190517173011 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $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');
  20.         $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');
  21.         $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');
  22.         $this->addSql('ALTER TABLE fos_user ADD CONSTRAINT FK_957A6479356FF84E FOREIGN KEY (organization_unit_id) REFERENCES organization_unit (id)');
  23.     }
  24.     public function down(Schema $schema) : void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  28.         $this->addSql('ALTER TABLE fos_user DROP FOREIGN KEY FK_957A6479356FF84E');
  29.         $this->addSql('DROP TABLE organization_unit');
  30.         $this->addSql('DROP TABLE setting');
  31.         $this->addSql('DROP TABLE fos_user');
  32.     }
  33. }