This commit is contained in:
2022-03-09 22:48:41 +00:00
parent 6e94270628
commit 38b18e74d1

View File

@@ -309,6 +309,8 @@ namespace AyaNova.Util
internal static async Task EmptyBizDataFromDatabaseForSeedingOrImportingAsync(ILogger _log, Guid jobIdToKeep)
{
bool forSeeding = jobIdToKeep != Guid.Empty;
_log.LogInformation("Erasing Database \"{0}\"", _dbName);
AyaNova.Api.ControllerHelpers.ApiServerState apiServerState = (AyaNova.Api.ControllerHelpers.ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(AyaNova.Api.ControllerHelpers.ApiServerState));
@@ -358,6 +360,11 @@ namespace AyaNova.Util
}
if (forSeeding)
{
cmd.CommandText = "update aglobalbizsettings set taxpartpurchaseid=null,taxpartsaleid=null,taxratesaleid=null;";
await cmd.ExecuteNonQueryAsync();
}
//DELIBERATELY NOT ERASED:
//NOTE: these tables commented below are deliberately not affected as it's assumed for a **COMPLETE** erase users will erase manually or use the config setting to completely drop the database
//For anything less than that it's assumed users are testing things out and want to keep these tables but erase the biz data
@@ -486,7 +493,8 @@ namespace AyaNova.Util
await EraseTableAsync("aservicerate", conn);
await EraseTableAsync("atravelrate", conn);
//await EraseTableAsync("ataxcode", conn);
if (forSeeding)
await EraseTableAsync("ataxcode", conn);
await EraseTableAsync("aquotestatus", conn);