From f11c06cf19396940ad78f4fbe17957c447932488 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 11 Mar 2022 00:44:39 +0000 Subject: [PATCH] --- server/AyaNova/Controllers/LicenseController.cs | 2 +- server/AyaNova/util/DbUtil.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/AyaNova/Controllers/LicenseController.cs b/server/AyaNova/Controllers/LicenseController.cs index cee9e406..61cb238c 100644 --- a/server/AyaNova/Controllers/LicenseController.cs +++ b/server/AyaNova/Controllers/LicenseController.cs @@ -265,7 +265,7 @@ namespace AyaNova.Api.Controllers //empty the db - await AyaNova.Util.DbUtil.EmptyBizDataFromDatabaseForSeedingOrImportingAsync(log, Guid.Empty); + await AyaNova.Util.DbUtil.EmptyBizDataFromDatabaseForSeedingOrImportingAsync(log, Guid.Empty, serverState.IsMigrateMode); //Log await EventLogProcessor.LogEventToDatabaseAsync(new Event(1, 0, AyaType.Global, AyaEvent.EraseAllData), ct); diff --git a/server/AyaNova/util/DbUtil.cs b/server/AyaNova/util/DbUtil.cs index 63bd3c00..64932c34 100644 --- a/server/AyaNova/util/DbUtil.cs +++ b/server/AyaNova/util/DbUtil.cs @@ -306,7 +306,7 @@ namespace AyaNova.Util // Erase all user entered data from the db // This is called by seeder for trial seeding purposes // and by v8 migrate and by license controller when erasing db - internal static async Task EmptyBizDataFromDatabaseForSeedingOrImportingAsync(ILogger _log, Guid jobIdToKeep) + internal static async Task EmptyBizDataFromDatabaseForSeedingOrImportingAsync(ILogger _log, Guid jobIdToKeep, bool isMigrate=false) { bool forSeeding = jobIdToKeep != Guid.Empty; @@ -360,7 +360,7 @@ namespace AyaNova.Util } - if (forSeeding) + if (forSeeding || isMigrate) { cmd.CommandText = "update aglobalbizsettings set taxpartpurchaseid=null,taxpartsaleid=null,taxratesaleid=null;"; await cmd.ExecuteNonQueryAsync(); @@ -493,7 +493,7 @@ namespace AyaNova.Util await EraseTableAsync("aservicerate", conn); await EraseTableAsync("atravelrate", conn); - if (forSeeding) + if (forSeeding || isMigrate) await EraseTableAsync("ataxcode", conn);