From 5fee0b6252d9546715e819823b829f28ec6f5a8f Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 2 May 2020 20:16:10 +0000 Subject: [PATCH] --- server/AyaNova/util/DbUtil.cs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/server/AyaNova/util/DbUtil.cs b/server/AyaNova/util/DbUtil.cs index 86443aa8..8dbf2a33 100644 --- a/server/AyaNova/util/DbUtil.cs +++ b/server/AyaNova/util/DbUtil.cs @@ -314,7 +314,7 @@ namespace AyaNova.Util await EraseTableAsync("aformcustom", conn); await EraseTableAsync("asearchkey", conn); await EraseTableAsync("asearchdictionary", conn); - await EraseTableAsync("atag", conn); + await EraseTableAsync("atag", conn); await EraseTableAsync("acustomer", conn); await EraseTableAsync("acontract", conn); await EraseTableAsync("aheadoffice", conn); @@ -377,27 +377,15 @@ namespace AyaNova.Util // CALLED BY LICENSE CONTROLLER AND LICENSE.CS FOR TRIAL Request check internal static async Task DBIsEmptyAsync(AyContext ct, ILogger _log) { - //TODO: This needs to be way more thorough, only the main tables though, no need to get crazy with it - //just stuff that would be shitty to have to re-enter + //For efficiency just check a few main tables just stuff that would be shitty to have to re-enter + //Mostly user, customer and vendor cover it because nearly everything else requires those to have any sort of data at all _log.LogDebug("DB empty check"); //An empty db contains only one User if (await ct.User.LongCountAsync() > 1) return false; - - - //No clients - //if(ctx.Client.Count()>0) return false; - - //No units - //if(ctx.Unit.Count()>0) return false; - - //No parts - //if(ctx.Part.Count()>0) return false; - - //No workorders - //if(ctx.Workorder.Count()>0) return false; - + if (await ct.Customer.AnyAsync()) return false; + if (await ct.Vendor.AnyAsync()) return false; return true; }