From 38b18e74d11134586972dfdb9c18ebc155f46ad9 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 9 Mar 2022 22:48:41 +0000 Subject: [PATCH] --- server/AyaNova/util/DbUtil.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/AyaNova/util/DbUtil.cs b/server/AyaNova/util/DbUtil.cs index 9cc2ccd2..e6ec9655 100644 --- a/server/AyaNova/util/DbUtil.cs +++ b/server/AyaNova/util/DbUtil.cs @@ -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);