X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=app%2FDoctrineMigrations%2FVersion20161118134328.php;h=7b2eeb7bd53333bdc76f8fd1662a6d01a5d2c5e2;hb=c406cef5b69b0d6c43adef33b5374b209347b637;hp=76dd90742e7bfd7f4c4733a1a75d93a05d1cd1ec;hpb=18d7bc3a353d8737c64a0f9e1c9fdcb7a756c3e5;p=github%2Fwallabag%2Fwallabag.git diff --git a/app/DoctrineMigrations/Version20161118134328.php b/app/DoctrineMigrations/Version20161118134328.php index 76dd9074..7b2eeb7b 100644 --- a/app/DoctrineMigrations/Version20161118134328.php +++ b/app/DoctrineMigrations/Version20161118134328.php @@ -32,9 +32,14 @@ class Version20161118134328 extends AbstractMigration implements ContainerAwareI */ public function up(Schema $schema) { - $this->skipIf($schema->getTable($this->getTable('entry'))->hasColumn('http_status'), 'It seems that you already played this migration.'); + $entryTable = $schema->getTable($this->getTable('entry')); - $this->addSql('ALTER TABLE '.$this->getTable('entry').' ADD http_status VARCHAR(3) DEFAULT NULL'); + $this->skipIf($entryTable->hasColumn('http_status'), 'It seems that you already played this migration.'); + + $entryTable->addColumn('http_status', 'string', [ + 'length' => 3, + 'notnull' => false, + ]); } /** @@ -42,8 +47,10 @@ 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.'); + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf(!$entryTable->hasColumn('http_status'), 'It seems that you already played this migration.'); - $this->addSql('ALTER TABLE '.$this->getTable('entry').' DROP http_status'); + $entryTable->dropColumn('http_status'); } }