public virtual bool Exists() { var exists = false; if (!_creator.Exists()) { return(exists); } var command = (SqlCommand)_connection.DbConnection.CreateCommand(); command.CommandText = @"SELECT 1 FROM [INFORMATION_SCHEMA].[TABLES] WHERE [TABLE_SCHEMA] = N'dbo' AND [TABLE_NAME] = '__MigrationHistory' AND [TABLE_TYPE] = 'BASE TABLE'"; _connection.Open(); try { exists = command.ExecuteScalar() != null; } finally { _connection.Close(); } return(exists); }
public override bool Exists() { try { _connection.Open(); _connection.Close(); return(true); } catch (NpgsqlException e) { if (IsDoesNotExist(e)) { return(false); } throw; } }