diff --git a/.vscode/launch.json b/.vscode/launch.json index 396abc9b..33155498 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -45,7 +45,7 @@ //"AYANOVA_LOG_LEVEL": "Debug", "AYANOVA_DEFAULT_TRANSLATION": "en", //TRANSLATION MUST BE en for Integration TESTING - //"AYANOVA_PERMANENTLY_ERASE_DATABASE": "true", + "AYANOVA_PERMANENTLY_ERASE_DATABASE": "true", "AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;", "AYANOVA_USE_URLS": "http://*:7575;", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", diff --git a/server/AyaNova/generator/CoreJobBackup.cs b/server/AyaNova/generator/CoreJobBackup.cs index 53dada97..38710809 100644 --- a/server/AyaNova/generator/CoreJobBackup.cs +++ b/server/AyaNova/generator/CoreJobBackup.cs @@ -30,6 +30,12 @@ namespace AyaNova.Biz if (!OnDemand) { log.LogTrace("Checking if backup should run"); + if (!ServerGlobalOpsSettingsCache.Backup.Active) + { + log.LogTrace("Automatic backup is set to INACTIVE - not backing up"); + return; + } + if (DateTime.UtcNow < ServerGlobalOpsSettingsCache.NextBackup) { log.LogTrace("Not past backup time yet"); diff --git a/server/AyaNova/models/GlobalOpsBackupSettings.cs b/server/AyaNova/models/GlobalOpsBackupSettings.cs index 5b82a804..100f6ed5 100644 --- a/server/AyaNova/models/GlobalOpsBackupSettings.cs +++ b/server/AyaNova/models/GlobalOpsBackupSettings.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel.DataAnnotations.Schema; namespace AyaNova.Models { @@ -7,17 +6,18 @@ namespace AyaNova.Models { public long Id { get; set; }//this is always 1 as there is only ever one single global Ops object public uint Concurrency { get; set; } - + public bool Active { get; set; } public DateTime BackupTime { get; set; } public int BackupSetsToKeep { get; set; } public bool BackupAttachments { get; set; } - + public GlobalOpsBackupSettings() { - Id = 1;//always 1 - BackupTime = new DateTime(2020, 5, 19, 23, 59, 0, DateTimeKind.Local).ToUniversalTime();//date doesn't matter it only uses hour - // BackupTime = DateTime.UtcNow.AddMinutes(-10);//for testing, above is regular + DateTime utcNow = DateTime.UtcNow; + Id = 1; + BackupTime = new DateTime(utcNow.Year, utcNow.Month, utcNow.Day, 23, 59, 0, DateTimeKind.Local).ToUniversalTime(); BackupSetsToKeep = 3; + Active = true; } } } diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 0598cb95..44d24613 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -22,7 +22,7 @@ namespace AyaNova.Util //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! private const int DESIRED_SCHEMA_LEVEL = 11; - internal const long EXPECTED_COLUMN_COUNT = 327; + internal const long EXPECTED_COLUMN_COUNT = 328; internal const long EXPECTED_INDEX_COUNT = 134; //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! @@ -233,7 +233,7 @@ namespace AyaNova.Util "searchcasesensitiveonly bool default false)"); //create global ops BACKUP settings table - await ExecQueryAsync("CREATE TABLE aglobalopsbackupsettings (id integer NOT NULL PRIMARY KEY, " + + await ExecQueryAsync("CREATE TABLE aglobalopsbackupsettings (id integer NOT NULL PRIMARY KEY, active bool not null, " + "backuptime timestamp, backupsetstokeep int, backupattachments bool)"); //create aevent biz event log table diff --git a/server/AyaNova/util/License.cs b/server/AyaNova/util/License.cs index 2d2f0cf1..44987d6f 100644 --- a/server/AyaNova/util/License.cs +++ b/server/AyaNova/util/License.cs @@ -32,7 +32,7 @@ namespace AyaNova.Core private const string LICENSE_SERVER_URL = "https://rockfish.ayanova.com/"; // #if (DEBUG) -// // private const string LICENSE_SERVER_URL = "https://nothing.exqqwweerccbjhjtgfample.com/"; + //IF TESTING LOCAL DEV ROCKFISH: // private const string LICENSE_SERVER_URL = "http://localhost:3001/"; // #else // private const string LICENSE_SERVER_URL = "https://rockfish.ayanova.com/";