This commit is contained in:
@@ -23,7 +23,7 @@ namespace AyaNova.Util
|
||||
private const int DESIRED_SCHEMA_LEVEL = 9;
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 100;
|
||||
internal const long EXPECTED_INDEX_COUNT = 23;
|
||||
internal const long EXPECTED_INDEX_COUNT = 22;
|
||||
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace AyaNova.Util
|
||||
"startdate timestamp, enddate timestamp, dollaramount decimal(19,5), active bool, roles int4, notes text)");
|
||||
|
||||
//TEST TEST TEST ONLY FOR DEVELOPMENT TESTING TO ENSURE UNIQUENESS
|
||||
exec("CREATE UNIQUE INDEX awidget_serial_idx ON awidget (serial);");
|
||||
//exec("CREATE UNIQUE INDEX awidget_serial_idx ON awidget (serial);");
|
||||
|
||||
|
||||
//Compound index for name fetching
|
||||
|
||||
@@ -2,6 +2,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq;
|
||||
|
||||
namespace AyaNova.Util
|
||||
{
|
||||
@@ -12,7 +14,8 @@ namespace AyaNova.Util
|
||||
internal static class ServerBootConfig
|
||||
{
|
||||
|
||||
//TEST AUTOID
|
||||
//AUTOID's
|
||||
|
||||
//Get the highest id number issued previously and start the auto-id at that level
|
||||
internal static AutoId WIDGET_SERIAL { get; set; }
|
||||
|
||||
@@ -202,6 +205,29 @@ namespace AyaNova.Util
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Get the auto-id most recent values at boot time
|
||||
internal static void SetMostRecentAutoIdValuesFromDatabase(AyaNova.Models.AyContext ct)
|
||||
{
|
||||
//WIDGET SERIALS
|
||||
if (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 = ct.Widget.AsNoTracking().OrderByDescending(x => x.Id).FirstOrDefault();
|
||||
uint MaxWidgetId = 0;
|
||||
if (MostRecentWidget != null)
|
||||
MaxWidgetId = MostRecentWidget.Serial;
|
||||
WIDGET_SERIAL = new AutoId(MaxWidgetId);
|
||||
|
||||
}
|
||||
|
||||
//OTHER SERIALS HERE IN FUTURE...
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user