From 9e2440fe15633532c2bf62feac1535a85d6eb840 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 17 Nov 2016 08:05:15 +0100 Subject: Fix migration --- app/DoctrineMigrations/Version20161106113822.php | 8 +++-- app/DoctrineMigrations/Version20161109150755.php | 40 --------------------- app/DoctrineMigrations/Version20161117071626.php | 44 ++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 43 deletions(-) delete mode 100644 app/DoctrineMigrations/Version20161109150755.php create mode 100644 app/DoctrineMigrations/Version20161117071626.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20161106113822.php b/app/DoctrineMigrations/Version20161106113822.php index 41e64a4a..edca54f5 100644 --- a/app/DoctrineMigrations/Version20161106113822.php +++ b/app/DoctrineMigrations/Version20161106113822.php @@ -4,8 +4,10 @@ namespace Application\Migrations; use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; +use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; -class Version20161106113822 extends AbstractMigration +class Version20161106113822 extends AbstractMigration implements ContainerAwareInterface { /** * @var ContainerInterface @@ -27,7 +29,7 @@ class Version20161106113822 extends AbstractMigration */ public function up(Schema $schema) { - $this->addSql('ALTER TABLE "'.$this->getTable('config').'" ADD action_mark_as_read INT DEFAULT 0'); + $this->addSql('ALTER TABLE '.$this->getTable('config').' ADD action_mark_as_read INT DEFAULT 0'); } /** @@ -37,6 +39,6 @@ class Version20161106113822 extends AbstractMigration { $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->addSql('ALTER TABLE "'.$this->getTable('config').'" DROP action_mark_as_read'); + $this->addSql('ALTER TABLE '.$this->getTable('config').' DROP action_mark_as_read'); } } diff --git a/app/DoctrineMigrations/Version20161109150755.php b/app/DoctrineMigrations/Version20161109150755.php deleted file mode 100644 index e4d269c4..00000000 --- a/app/DoctrineMigrations/Version20161109150755.php +++ /dev/null @@ -1,40 +0,0 @@ -container = $container; - } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix') . $tableName; - } - /** - * @param Schema $schema - */ - 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')"); - } - /** - * @param Schema $schema - */ - 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';"); - } -} diff --git a/app/DoctrineMigrations/Version20161117071626.php b/app/DoctrineMigrations/Version20161117071626.php new file mode 100644 index 00000000..9ae55b5f --- /dev/null +++ b/app/DoctrineMigrations/Version20161117071626.php @@ -0,0 +1,44 @@ +container = $container; + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } + + /** + * @param Schema $schema + */ + 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')"); + } + + /** + * @param Schema $schema + */ + 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';"); + } +} -- cgit v1.2.3