Skip to content

Commit 6a34455

Browse files
marcusberroji
authored andcommitted
Always close connection after reloading types in migration. (#3465)
Closes #3464 (cherry picked from commit 786b635)
1 parent e952c84 commit 6a34455

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/EFCore.PG/Migrations/Internal/NpgsqlMigrator.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public override void Migrate(string? targetMigration)
8585
{
8686
npgsqlConnection.ReloadTypes();
8787
}
88-
catch
88+
finally
8989
{
9090
_connection.Close();
9191
}
@@ -128,7 +128,7 @@ public override async Task MigrateAsync(string? targetMigration, CancellationTok
128128
{
129129
await npgsqlConnection.ReloadTypesAsync(cancellationToken).ConfigureAwait(false);
130130
}
131-
catch
131+
finally
132132
{
133133
await _connection.CloseAsync().ConfigureAwait(false);
134134
}

0 commit comments

Comments
 (0)