<?php
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
class Version20160101000000 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema) : void
{
// Migration de l'ancienne table des migrations "migration_versions" vers la nouvelle table "doctrine_migration_versions"
$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;");
$this->addSql("
DROP TABLE IF EXISTS simplesamlphp_kvstore;
DROP TABLE IF EXISTS simplesamlphp_saml_logoutstore;
DROP TABLE IF EXISTS simplesamlphp_tableversion;
DROP TABLE IF EXISTS migration_versions;
");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$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 = \'\' ');
$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 = \'\' ');
$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 = \'\' ');
$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 = \'\' ');
$this->addSql('INSERT INTO migration_versions (version) SELECT TRIM(Trailing "DoctrineMigrations\\Version" FROM version) FROM doctrine_migration_versions');
}
}