X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=app%2FDoctrineMigrations%2FVersion20161122203647.php;h=ef08bd59d5f511f82e4acc38f63f7b54db05d6ae;hb=f808b01692a835673f328d7221ba8c212caa9b61;hp=94197193cdc3d6c277749330128b17eb467e35cc;hpb=9abac9651fd0af4586245364657dc9455ba5c73c;p=github%2Fwallabag%2Fwallabag.git diff --git a/app/DoctrineMigrations/Version20161122203647.php b/app/DoctrineMigrations/Version20161122203647.php index 94197193..ef08bd59 100644 --- a/app/DoctrineMigrations/Version20161122203647.php +++ b/app/DoctrineMigrations/Version20161122203647.php @@ -30,11 +30,6 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI $this->container = $container; } - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -54,7 +49,15 @@ class Version20161122203647 extends AbstractMigration implements ContainerAwareI public function down(Schema $schema) { $userTable = $schema->getTable($this->getTable('user')); - $userTable->addColumn('expired', 'smallint'); - $userTable->addColumn('credentials_expired', 'smallint'); + + $this->skipIf(true === $userTable->hasColumn('expired') || true === $userTable->hasColumn('credentials_expired'), 'It seems that you already played this migration.'); + + $userTable->addColumn('expired', 'smallint', ['notnull' => false]); + $userTable->addColumn('credentials_expired', 'smallint', ['notnull' => false]); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; } }