Do not crash sqlite migration if the db is create but without tables

This commit is contained in:
nicolas.dorier 2023-03-01 15:04:17 +09:00
parent 2f88da67e8
commit 5790bed766
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE

View File

@ -183,7 +183,7 @@ namespace BTCPayServer.Hosting
if (state == null)
throw new ConfigException("This postgres database isn't created during a migration. Please use an empty database for postgres when migrating. If it's not a migration, remove --sqlitefile or --mysql settings.");
}
catch (NpgsqlException ex) when (ex.SqlState == PostgresErrorCodes.InvalidCatalogName) // DB doesn't exists
catch (NpgsqlException ex) when (ex.SqlState == PostgresErrorCodes.InvalidCatalogName || ex.SqlState == PostgresErrorCodes.UndefinedTable) // DB doesn't exists
{
await postgresContext.Database.MigrateAsync();
state = "pending";