This commit is contained in:
2020-05-24 23:55:22 +00:00
parent e385ef5012
commit 731b18cc69
4 changed files with 37 additions and 7 deletions

View File

@@ -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 = 310;
internal const long EXPECTED_COLUMN_COUNT = 312;
internal const long EXPECTED_INDEX_COUNT = 134;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
@@ -33,6 +33,7 @@ namespace AyaNova.Util
/*
MAXIMUM POSTGRES OBJECT NAME LENGTH: 63 CHARACTERS
CURRENCY: use decimal(19,4)
HOW TO INDEX
@@ -242,8 +243,12 @@ namespace AyaNova.Util
await ExecQueryAsync("CREATE INDEX aevent_userid_idx ON aevent (userid);");
//SEARCH TABLES
//METRICS TABLES
//CPU
await ExecQueryAsync("CREATE TABLE ametriccpu (t timestamp not null, v double precision not null default 0)");
//SEARCH TABLES
await ExecQueryAsync("CREATE TABLE asearchdictionary (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, word varchar(255) not null)");
//Must be unique and also this is hit a *lot* during searches and also indexing
await ExecQueryAsync("CREATE UNIQUE INDEX asearchdictionary_word_idx ON asearchdictionary (word);");
@@ -353,7 +358,7 @@ $BODY$;
//Add widget table
//id, text, longtext, boolean, currency,
await ExecQueryAsync("CREATE TABLE awidget (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, serial bigint generated by default as identity not null," +
"startdate timestamp, enddate timestamp, dollaramount decimal(19,5), active bool, usertype int4, count integer," +
"startdate timestamp, enddate timestamp, dollaramount decimal(19,4), active bool, usertype int4, count integer," +
"notes text, userid bigint null, wiki text null, customfields text, tags varchar(255) ARRAY)");
//TEST TEST TEST ONLY FOR DEVELOPMENT TESTING TO ENSURE UNIQUENESS

View File

@@ -85,7 +85,22 @@ namespace AyaNova.Util
//Erase all the data except for the license, schema and the manager user
await DbUtil.EmptyBizDataFromDatabaseForSeedingOrImportingAsync(log);
apiServerState.SetOpsOnly("Seeding database with sample data");
//TEST METRICS SIZE
using (var cct = ServiceProviderProvider.DBContext)
{
var TestCount = 365 * 24 * 60;//525600 minutes in a year
for (int i = 0; i < TestCount; i++)
{
cct.MetricCPU.Add(new MetricCPU() { v = 33.33333 });
}
cct.SaveChanges();
}
//WIDGET sample form customization
{