case 4396

This commit is contained in:
2023-01-24 21:51:09 +00:00
parent e0465fdd06
commit ca25d096ed
2 changed files with 277 additions and 272 deletions

4
.vscode/launch.json vendored
View File

@@ -118,8 +118,8 @@
"AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;CommandTimeout=300;",
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
"AYANOVA_USE_URLS": "http://*:7575;",
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
// "AYANOVA_REMOVE_LICENSE_FROM_DB":"true",
"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
"AYANOVA_REMOVE_LICENSE_FROM_DB":"true",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin"
},
"sourceFileMap": {

View File

@@ -405,16 +405,14 @@ namespace AyaNova.Util
//- select the superuser account back to the auser and useroptions
//- discover where else this needs to be done
//- $profit
_log.LogInformation("Erasing Database \"{0}\"", _dbName);
AyaNova.Api.ControllerHelpers.ApiServerState apiServerState = (AyaNova.Api.ControllerHelpers.ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(AyaNova.Api.ControllerHelpers.ApiServerState));
apiServerState.SetClosed("Erasing database");
try
{
//clear all connections so that the database can be dropped
Npgsql.NpgsqlConnection.ClearAllPools();
@@ -693,11 +691,18 @@ namespace AyaNova.Util
_log.LogInformation("Importing any missing stock Report templates");
await AyaNova.Biz.PrimeData.PrimeReportTemplates();
apiServerState.ResumePriorState();
_log.LogInformation("Database erase completed");
}
catch (Exception ex)
{
//NOTE: deliberately leaving server in CLOSED state so users see that there is a problem
//and investigate
_log.LogCritical(ex, "Unable to erase database due to unexpected condition. Please contact technical support to resolve.");
}
}