As part of #34115, the implementation of HistoryRepository.Exists was changed to no longer use the DatabaseCreator:
Old Exists
public virtual bool Exists()
=> Dependencies.DatabaseCreator.Exists()
&& InterpretExistsResult(
Dependencies.RawSqlCommandBuilder.Build(ExistsSql).ExecuteScalar(
new RelationalCommandParameterObject(
Dependencies.Connection,
null,
null,
Dependencies.CurrentContext.Context,
Dependencies.CommandLogger, CommandSource.Migrations)));
New Exists
public virtual bool Exists()
=> InterpretExistsResult(
Dependencies.RawSqlCommandBuilder.Build(ExistsSql).ExecuteScalar(
new RelationalCommandParameterObject(
Dependencies.Connection,
null,
null,
Dependencies.CurrentContext.Context,
Dependencies.CommandLogger, CommandSource.Migrations)));
This breaks PG, and likely other databases as well - it assumes that one can connect/login with the connection string containing the non-existing database, and then find out whether the database exists via the query. But in PG you can't connect to a non-existing database.
As a result, NpgsqlDatabaseCreator implements its Exists by simply trying to connect, and interpreting "database doesn't exist" behavior to return false etc.
As part of #34115, the implementation of HistoryRepository.Exists was changed to no longer use the DatabaseCreator:
Old Exists
New Exists
This breaks PG, and likely other databases as well - it assumes that one can connect/login with the connection string containing the non-existing database, and then find out whether the database exists via the query. But in PG you can't connect to a non-existing database.
As a result, NpgsqlDatabaseCreator implements its Exists by simply trying to connect, and interpreting "database doesn't exist" behavior to return false etc.