From ad46f2fb46bf97d520a82ec5c15266e3c48c4e0b Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 12 Dec 2017 13:41:44 +0100 Subject: [PATCH] Use hasTable instead of try/catch --- app/DoctrineMigrations/Version20160401000000.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) 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': -- 2.41.0