This commit is contained in:
@@ -363,7 +363,7 @@ namespace AyaNova
|
||||
// ******************** TESTING WIPE DB *****************************
|
||||
//
|
||||
//Set this to true to wipe the db and reinstall a trial license and re-seed the data
|
||||
var TESTING_REFRESH_DB = false;
|
||||
var TESTING_REFRESH_DB = true;
|
||||
|
||||
#if (DEBUG)
|
||||
//TESTING
|
||||
@@ -372,8 +372,6 @@ namespace AyaNova
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
if (ServerBootConfig.AYANOVA_PERMANENTLY_ERASE_DATABASE)
|
||||
{
|
||||
_log.LogWarning("BOOT: AYANOVA_PERMANENTLY_ERASE_DATABASE is true, dropping and recreating database");
|
||||
@@ -389,8 +387,6 @@ namespace AyaNova
|
||||
_log.LogDebug("BOOT: db integrity check");
|
||||
DbUtil.CheckFingerPrint(AySchema.EXPECTED_COLUMN_COUNT, AySchema.EXPECTED_INDEX_COUNT, _log);
|
||||
|
||||
|
||||
|
||||
//Initialize license
|
||||
AyaNova.Core.License.Initialize(apiServerState, dbContext, _log);
|
||||
|
||||
@@ -405,25 +401,14 @@ namespace AyaNova
|
||||
if (TESTING_REFRESH_DB)
|
||||
{
|
||||
AyaNova.Core.License.Fetch(apiServerState, dbContext, _log);
|
||||
Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.HugeForLoadTest);
|
||||
Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.SmallOneManShopTrialDataSet);
|
||||
}
|
||||
//TESTING
|
||||
#endif
|
||||
|
||||
|
||||
//TEST AUTOID
|
||||
//Note that seeder may init this already in which case this code doesn't even need to run
|
||||
if (ServerBootConfig.WIDGET_SERIAL == null)
|
||||
{
|
||||
//query for most recently used serial number
|
||||
//(note, can't query for highest serial as it can and likely will reset or be changed manually from time to time
|
||||
// so the algorithm is to keep the most recent sequence going on startup of the server)
|
||||
var MostRecentWidget = dbContext.Widget.AsNoTracking().OrderByDescending(x => x.Id).FirstOrDefault();
|
||||
uint MaxWidgetId = 0;
|
||||
if (MostRecentWidget != null)
|
||||
MaxWidgetId = MostRecentWidget.Serial;
|
||||
ServerBootConfig.WIDGET_SERIAL = new AutoId(MaxWidgetId);
|
||||
}
|
||||
|
||||
//Set autoId values
|
||||
ServerBootConfig.SetMostRecentAutoIdValuesFromDatabase(dbContext);
|
||||
|
||||
//Open up the server for visitors
|
||||
apiServerState.SetOpen();
|
||||
|
||||
Reference in New Issue
Block a user