Closed AWehrhahn closed 3 months ago
Hi @AWehrhahn,
I'm not an expert on Postgres and the code inside the Postgres EnsureClean
was provided Shay Rojansky from the Microsoft EF Core team, so I can't provide a solution myself. It looks like the Postgres code in PostgreSqlDropSchemaEnsureClean doesn't support schemas.
The Postgres EnsureClean
is the fastest way to create an empty Postgres database, but using EnsureDeleted
+ EnsureCreated
is still under a second, so I would suggest you use that instead.
When using EnsureClean() to create a empty database I get the following error:
Npgsql.PostgresException: 3F000: schema "_timescaledb_debug" does not exist
It does exist before EnsureClean, but gets dropped when the public schema gets dropped, but EnsureClean still tries to delete it. This happens e.g. when using the timescaledb extension. Maybe a simple IF EXISTS in the DROP SCHEMA will prevent this error?Here is a simple example: