From: Jeremy Benoist Date: Tue, 12 Dec 2017 12:41:44 +0000 (+0100) Subject: Use hasTable instead of try/catch X-Git-Tag: 2.3.1~18^2~1 X-Git-Url: https://git.immae.eu/?p=github%2Fwallabag%2Fwallabag.git;a=commitdiff_plain;h=ad46f2fb46bf97d520a82ec5c15266e3c48c4e0b Use hasTable instead of try/catch --- diff --git a/app/DoctrineMigrations/Version20160401000000.php b/app/DoctrineMigrations/Version20160401000000.php index 54bfb0f0..9916321f 100644 --- a/app/DoctrineMigrations/Version20160401000000.php +++ b/app/DoctrineMigrations/Version20160401000000.php @@ -28,13 +28,7 @@ class Version20160401000000 extends AbstractMigration implements ContainerAwareI */ public function up(Schema $schema) { - try { - $schema->getTable($this->getTable('entry')); - - $this->skipIf(true, 'Database already initialized'); - } catch (SchemaException $e) { - // it's ok, the table does not exist we can proceed to the initial migration - } + $this->skipIf($schema->hasTable($this->getTable('entry')), 'Database already initialized'); switch ($this->connection->getDatabasePlatform()->getName()) { case 'sqlite':