Final release candidate 8.0.1 - holy shit commit!
This commit is contained in:
@@ -599,32 +599,33 @@ namespace AyaNova
|
||||
//if there is a build date issue or a license issue it will fail with an exception, log to log file, log to console and not go beyond the license check preserving the db
|
||||
//Note: case 4160 is to build an external license fetcher utility to allow a user to upgrade without uninstalling the newer version by purchasing a new sub and installing the key out of AyaNova
|
||||
//If they don't want to purchase then they must downgrade
|
||||
var tempSchema = dbContext.SchemaVersion.AsNoTracking().SingleOrDefault();
|
||||
var tempLicense = dbContext.License.AsNoTracking().SingleOrDefault();
|
||||
bool licenseChecked = false;
|
||||
if (tempSchema != null && tempLicense != null && !string.IsNullOrWhiteSpace(tempSchema.Id))
|
||||
try
|
||||
{
|
||||
//we have a schema and a license, check it now thus triggering build date vs maintenance expiry check
|
||||
try
|
||||
//NOTE: a completely missing db will trigger an exception on this line, we expect that and will be fine as the schema check will run below and create the tables required
|
||||
var tempSchema = dbContext.SchemaVersion.AsNoTracking().SingleOrDefault();
|
||||
var tempLicense = dbContext.License.AsNoTracking().SingleOrDefault();
|
||||
|
||||
if (tempSchema != null && tempLicense != null && !string.IsNullOrWhiteSpace(tempSchema.Id))
|
||||
{
|
||||
//we have a schema and a license, check it now thus triggering build date vs maintenance expiry check
|
||||
|
||||
AyaNova.Core.License.InitializeAsync(apiServerState, dbContext, _newLog).Wait();
|
||||
licenseChecked = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//Only re-throw if it's a 1020 error with the text VERSION-TOO-NEW included, any other error allow it to keep doing it's thing below before the second license init
|
||||
//our exception is buried inside multiple inner exceptions but it's the innermost so drill down into it
|
||||
while (ex.InnerException != null)
|
||||
ex = ex.InnerException;
|
||||
if (ex.Message.Contains("1020") && ex.Message.Contains("VERSION-TOO-NEW "))
|
||||
{
|
||||
//Only re-throw if it's a 1020 error with the text VERSION-TOO-NEW included, any other error allow it to keep doing it's thing below before the second license init
|
||||
//our exception is buried inside multiple inner exceptions but it's the innermost so drill down into it
|
||||
while (ex.InnerException != null)
|
||||
ex = ex.InnerException;
|
||||
if (ex.Message.Contains("1020") && ex.Message.Contains("VERSION-TOO-NEW "))
|
||||
{
|
||||
throw new Exception("AyaNova did not start to protect the integrity of your data, see the console and / or error log for details");
|
||||
}
|
||||
throw new Exception("AyaNova did not start to protect the integrity of your data, see the console and / or error log for details");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Check schema
|
||||
_newLog.LogDebug("DB schema check");
|
||||
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
|
||||
|
||||
Reference in New Issue
Block a user