Replaced abortIf with skipIf

This commit is contained in:
Nicolas Lœuillet 2016-11-26 13:34:36 +01:00
parent 18d7bc3a35
commit a4d55a9161
12 changed files with 22 additions and 24 deletions

View file

@ -50,7 +50,7 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->addSql('ALTER TABLE '.$this->getTable('oauth2_clients').' DROP COLUMN name');
}

View file

@ -21,7 +21,7 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI
private function getTable($tableName)
{
return $this->container->getParameter('database_table_prefix') . $tableName;
return $this->container->getParameter('database_table_prefix').$tableName;
}
/**

View file

@ -40,7 +40,7 @@ class Version20160916201049 extends AbstractMigration implements ContainerAwareI
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->addSql('ALTER TABLE "'.$this->getTable('config').'" DROP pocket_consumer_key');
$this->addSql('INSERT INTO "'.$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('pocket_consumer_key', NULL, 'import')");

View file

@ -21,7 +21,7 @@ class Version20161001072726 extends AbstractMigration implements ContainerAwareI
private function getTable($tableName)
{
return $this->container->getParameter('database_table_prefix') . $tableName;
return $this->container->getParameter('database_table_prefix').$tableName;
}
/**

View file

@ -21,7 +21,7 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI
private function getTable($tableName)
{
return $this->container->getParameter('database_table_prefix') . $tableName;
return $this->container->getParameter('database_table_prefix').$tableName;
}
/**
@ -72,6 +72,5 @@ class Version20161022134138 extends AbstractMigration implements ContainerAwareI
$this->addSql('ALTER TABLE '.$this->getTable('tag').' CHANGE `label` `label` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
$this->addSql('ALTER TABLE '.$this->getTable('user').' CHANGE `name` `name` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
}
}

View file

@ -21,7 +21,7 @@ class Version20161031132655 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,7 +29,7 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI
*/
public function up(Schema $schema)
{
$this->addSql("INSERT INTO \"".$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('download_images_enabled', 0, 'misc')");
$this->addSql('INSERT INTO "'.$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('download_images_enabled', 0, 'misc')");
}
/**
@ -37,8 +37,8 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->skipIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->addSql("DELETE FROM \"".$this->getTable('craue_config_setting')."\" WHERE name = 'download_images_enabled';");
$this->addSql('DELETE FROM "'.$this->getTable('craue_config_setting')."\" WHERE name = 'download_images_enabled';");
}
}

View file

@ -21,7 +21,7 @@ class Version20161104073720 extends AbstractMigration implements ContainerAwareI
private function getTable($tableName)
{
return $this->container->getParameter('database_table_prefix') . $tableName;
return $this->container->getParameter('database_table_prefix').$tableName;
}
/**
@ -48,6 +48,5 @@ class Version20161104073720 extends AbstractMigration implements ContainerAwareI
*/
public function down(Schema $schema)
{
}
}

View file

@ -39,7 +39,7 @@ class Version20161106113822 extends AbstractMigration implements ContainerAwareI
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
$this->skipIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
$this->addSql('ALTER TABLE '.$this->getTable('config').' DROP action_mark_as_read');
}

View file

@ -21,7 +21,7 @@ class Version20161117071626 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,8 +29,8 @@ class Version20161117071626 extends AbstractMigration implements ContainerAwareI
*/
public function up(Schema $schema)
{
$this->addSql("INSERT INTO ".$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_unmark', 0, 'entry')");
$this->addSql("INSERT INTO ".$this->getTable('craue_config_setting')." (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')");
$this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_unmark', 0, 'entry')");
$this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')");
}
/**
@ -38,7 +38,7 @@ class Version20161117071626 extends AbstractMigration implements ContainerAwareI
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM ".$this->getTable('craue_config_setting')." WHERE name = 'share_unmark';");
$this->addSql("DELETE FROM ".$this->getTable('craue_config_setting')." WHERE name = 'unmark_url';");
$this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'share_unmark';");
$this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'unmark_url';");
}
}

View file

@ -42,7 +42,7 @@ class Version20161118134328 extends AbstractMigration implements ContainerAwareI
*/
public function down(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
$this->skipIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
$this->addSql('ALTER TABLE '.$this->getTable('entry').' DROP http_status');
}

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Add the restricted_access internal setting for articles with paywall
* Add the restricted_access internal setting for articles with paywall.
*/
class Version20161122144743 extends AbstractMigration implements ContainerAwareInterface
{
@ -24,7 +24,7 @@ class Version20161122144743 extends AbstractMigration implements ContainerAwareI
private function getTable($tableName)
{
return $this->container->getParameter('database_table_prefix') . $tableName;
return $this->container->getParameter('database_table_prefix').$tableName;
}
/**
@ -32,7 +32,7 @@ class Version20161122144743 extends AbstractMigration implements ContainerAwareI
*/
public function up(Schema $schema)
{
$this->addSql("INSERT INTO ".$this->getTable('craue_config_setting')." (name, value, section) VALUES ('restricted_access', 0, 'entry')");
$this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('restricted_access', 0, 'entry')");
}
/**
@ -40,6 +40,6 @@ class Version20161122144743 extends AbstractMigration implements ContainerAwareI
*/
public function down(Schema $schema)
{
$this->addSql("DELETE FROM ".$this->getTable('craue_config_setting')." WHERE name = 'restricted_access';");
$this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'restricted_access';");
}
}

View file

@ -40,7 +40,7 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI
*/
public function up(Schema $schema)
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() === 'sqlite', 'This up migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
$this->skipIf($this->connection->getDatabasePlatform()->getName() === 'sqlite', 'This up migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
$this->skipIf(false === $schema->getTable($this->getTable('user'))->hasColumn('expired'), 'It seems that you already played this migration.');