Added checks on migrations

This commit is contained in:
Nicolas Lœuillet
2016-11-25 17:43:28 +01:00
parent 986cb53645
commit 18d7bc3a35
6 changed files with 25 additions and 11 deletions

View File

@ -21,7 +21,7 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI
private function getTable($tableName)
{
return $this->container->getParameter('database_table_prefix') . $tableName;
return $this->container->getParameter('database_table_prefix').$tableName;
}
/**
@ -29,6 +29,8 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI
*/
public function up(Schema $schema)
{
$this->skipIf($schema->getTable($this->getTable('oauth2_clients'))->hasColumn('name'), 'It seems that you already played this migration.');
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' ADD name longtext DEFAULT NULL');