migrations/Version20160101000000.php line 1

Open in your IDE?
  1. <?php
  2. namespace DoctrineMigrations;
  3. use Doctrine\DBAL\Schema\Schema;
  4. use Doctrine\Migrations\AbstractMigration;
  5. class Version20160101000000 extends AbstractMigration
  6. {
  7.     /**
  8.      * @param Schema $schema
  9.      */
  10.     public function up(Schema $schema) : void
  11.     {
  12.         // Migration de l'ancienne table des migrations "migration_versions" vers la nouvelle table "doctrine_migration_versions"
  13.         $this->addSql("INSERT INTO doctrine_migration_versions (version, executed_at, execution_time) SELECT concat('DoctrineMigrations\\\Version', version), '2016-01-01 00:00:00', 1 FROM migration_versions;");
  14.         $this->addSql("
  15.             DROP TABLE IF EXISTS simplesamlphp_kvstore;
  16.             DROP TABLE IF EXISTS simplesamlphp_saml_logoutstore;
  17.             DROP TABLE IF EXISTS simplesamlphp_tableversion;
  18.             DROP TABLE IF EXISTS migration_versions;
  19.         ");
  20.     }
  21.     /**
  22.      * @param Schema $schema
  23.      */
  24.     public function down(Schema $schema) : void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('CREATE TABLE migration_versions (version VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, PRIMARY KEY(version)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  28.         $this->addSql('CREATE TABLE simplesamlphp_kvstore (_type VARCHAR(30) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, _key VARCHAR(50) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, _value LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, _expire DATETIME DEFAULT NULL, INDEX simpleSAMLphp_kvstore_expire (_expire), PRIMARY KEY(_key, _type)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB COMMENT = \'\' ');
  29.         $this->addSql('CREATE TABLE simplesamlphp_saml_logoutstore (_authSource VARCHAR(30) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, _nameId VARCHAR(40) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, _sessionIndex VARCHAR(50) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, _expire DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, _sessionId VARCHAR(50) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, INDEX simpleSAMLphp_saml_LogoutStore_nameId (_authSource, _nameId), UNIQUE INDEX _authSource (_authSource, _nameId, _sessionIndex), INDEX simpleSAMLphp_saml_LogoutStore_expire (_expire)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB COMMENT = \'\' ');
  30.         $this->addSql('CREATE TABLE simplesamlphp_tableversion (_name VARCHAR(30) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, _version INT NOT NULL, UNIQUE INDEX _name (_name)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB COMMENT = \'\' ');
  31.         $this->addSql('INSERT INTO migration_versions (version) SELECT TRIM(Trailing "DoctrineMigrations\\Version" FROM version) FROM doctrine_migration_versions');
  32.     }
  33. }