Ensure craue_config_setting migration are ok

We now can run the migration every time, new line from `craue_config_setting` are properly checked.
This commit is contained in:
Jeremy Benoist 2016-12-04 12:56:20 +01:00
parent 24becc9717
commit 31fec5f363
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
4 changed files with 52 additions and 4 deletions

View file

@ -29,10 +29,27 @@ class Version20160911214952 extends AbstractMigration implements ContainerAwareI
*/
public function up(Schema $schema)
{
$redis = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting').' WHERE name = "import_with_redis"');
if (false === $redis) {
$this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('import_with_redis', 0, 'import')");
}
$rabbitmq = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting').' WHERE name = "import_with_rabbitmq"');
if (false === $rabbitmq) {
$this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('import_with_rabbitmq', 0, 'import')");
}
$this->skipIf(false !== $rabbitmq && false !== $redis, 'It seems that you already played this migration.');
}
/**
* @param Schema $schema
*/

View file

@ -29,6 +29,13 @@ class Version20161031132655 extends AbstractMigration implements ContainerAwareI
*/
public function up(Schema $schema)
{
$images = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting').' WHERE name = "download_images_enabled"');
$this->skipIf(false !== $images, 'It seems that you already played this migration.');
$this->addSql('INSERT INTO "'.$this->getTable('craue_config_setting')."\" (name, value, section) VALUES ('download_images_enabled', 0, 'misc')");
}

View file

@ -29,10 +29,27 @@ class Version20161117071626 extends AbstractMigration implements ContainerAwareI
*/
public function up(Schema $schema)
{
$share = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting').' WHERE name = "share_unmark"');
if (false === $share) {
$this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('share_unmark', 0, 'entry')");
}
$unmark = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting').' WHERE name = "unmark_url"');
if (false === $unmark) {
$this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')");
}
$this->skipIf(false !== $share && false !== $unmark, 'It seems that you already played this migration.');
}
/**
* @param Schema $schema
*/

View file

@ -32,6 +32,13 @@ class Version20161122144743 extends AbstractMigration implements ContainerAwareI
*/
public function up(Schema $schema)
{
$access = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting').' WHERE name = "restricted_access"');
$this->skipIf(false !== $access, 'It seems that you already played this migration.');
$this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('restricted_access', 0, 'entry')");
}