This commit is contained in:
2020-03-25 22:07:37 +00:00
parent 0302add504
commit 98d6d13ba9
4 changed files with 58 additions and 36 deletions

View File

@@ -413,20 +413,28 @@ 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 = true;//#######################################################################################
//DEPRECATED, now use boot setting AYANOVA_SERVER_TEST_MODE
// var TESTING_REFRESH_DB = true;//#######################################################################################
#if (DEBUG)
// #if (DEBUG)
//TESTING
if (TESTING_REFRESH_DB)
ServerBootConfig.AYANOVA_PERMANENTLY_ERASE_DATABASE = TESTING_REFRESH_DB;
//TESTING
#endif
// //TESTING
// if (TESTING_REFRESH_DB)
// ServerBootConfig.AYANOVA_PERMANENTLY_ERASE_DATABASE = TESTING_REFRESH_DB;
// //TESTING
// #endif
if (ServerBootConfig.AYANOVA_PERMANENTLY_ERASE_DATABASE)
if (ServerBootConfig.AYANOVA_PERMANENTLY_ERASE_DATABASE || ServerBootConfig.AYANOVA_SERVER_TEST_MODE)
{
_newLog.LogWarning("BOOT: AYANOVA_PERMANENTLY_ERASE_DATABASE is true, dropping and recreating database");
if (ServerBootConfig.AYANOVA_SERVER_TEST_MODE)
{
_newLog.LogWarning("BOOT: AYANOVA_SERVER_TEST_MODE is true, dropping and recreating database");
}
else
{
_newLog.LogWarning("BOOT: AYANOVA_PERMANENTLY_ERASE_DATABASE is true, dropping and recreating database");
}
Util.DbUtil.DropAndRecreateDbAsync(_newLog).Wait();
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
}
@@ -451,17 +459,16 @@ namespace AyaNova
lb.ValidateTranslationsAsync().Wait();
#if (DEBUG)
//TESTING
if (TESTING_REFRESH_DB)
if (ServerBootConfig.AYANOVA_SERVER_TEST_MODE)
{
_newLog.LogInformation($"BOOT: server test mode seeding, level is {ServerBootConfig.AYANOVA_SERVER_TEST_MODE_SEEDLEVEL}, tz offset is {ServerBootConfig.AYANOVA_SERVER_TEST_MODE_TZ_OFFSET}");
AyaNova.Core.License.FetchKeyAsync(apiServerState, dbContext, _newLog).Wait();
//NOTE: For unit testing make sure the time zone is same as tester to ensure list filter by date tests will work because server is on same page as user in terms of time
Util.Seeder.SeedDatabaseAsync(Util.Seeder.SeedLevel.SmallOneManShopTrialDataSet, -8).Wait();//#############################################################################################
Util.Seeder.SeedDatabaseAsync(Util.Seeder.StringToSeedLevel(ServerBootConfig.AYANOVA_SERVER_TEST_MODE_SEEDLEVEL), ServerBootConfig.AYANOVA_SERVER_TEST_MODE_TZ_OFFSET).Wait();
}
//TESTING
#endif
//AUTOID VALUES INITIALIZATION