Use hasTable instead of try/catch

This commit is contained in:
Jeremy Benoist 2017-12-12 13:41:44 +01:00
parent 43e1711eb6
commit ad46f2fb46
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C

View file

@ -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':