This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
todo: check attachment NOTES property is actually supported
|
||||
- case https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/2029
|
||||
|
||||
//todo: search tables in schema, I think there is a missing index here, need to look at the search query section again as it was changed several times from the original schema creation
|
||||
|
||||
todo: api / server landing page is shitty on a mobile
|
||||
|
||||
todo: add query fail logging to datalist just like done with picklist so in production can catch mysterious problems more easily
|
||||
|
||||
22
server/AyaNova/models/WikiPage.cs
Normal file
22
server/AyaNova/models/WikiPage.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using AyaNova.Biz;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
|
||||
public partial class WikiPage
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public uint ConcurrencyToken { get; set; }
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
[Required]
|
||||
public long ObjectId { get; set; }
|
||||
[Required]
|
||||
public AyaType ObjectType { get; set; }//int
|
||||
|
||||
public string Content { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -139,31 +139,29 @@ namespace AyaNova.Util
|
||||
LogUpdateMessage(log);
|
||||
|
||||
//create global biz settings table
|
||||
await ExecQueryAsync("CREATE TABLE aglobalbizsettings (id integer NOT NULL PRIMARY KEY, " +
|
||||
"searchcasesensitiveonly bool default false)");
|
||||
await ExecQueryAsync("CREATE TABLE aglobalbizsettings (id integer NOT NULL PRIMARY KEY, " +
|
||||
"searchcasesensitiveonly bool default false)");
|
||||
|
||||
//create aevent biz event log table
|
||||
await ExecQueryAsync("CREATE TABLE aevent (id BIGSERIAL PRIMARY KEY, created timestamp not null, userid bigint not null," +
|
||||
"ayid bigint not null, aytype integer not null, ayevent integer not null, textra varchar(255))");
|
||||
//INDEX: Most selective first as there is more unique ID's than unique types
|
||||
await ExecQueryAsync("CREATE INDEX aevent_typeid_idx ON aevent (ayid, aytype);");
|
||||
await ExecQueryAsync("CREATE INDEX aevent_userid_idx ON aevent (userid);");
|
||||
|
||||
|
||||
//SEARCH TABLES
|
||||
await ExecQueryAsync("CREATE TABLE asearchdictionary (id BIGSERIAL PRIMARY KEY, word varchar(255) not null)");
|
||||
|
||||
//Search dictionary words must be unique
|
||||
await ExecQueryAsync("CREATE UNIQUE INDEX asearchdictionary_word_idx ON asearchdictionary (word);");
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE asearchkey (id BIGSERIAL PRIMARY KEY, wordid bigint not null REFERENCES asearchdictionary (id), objectid bigint not null, objecttype integer not null)");
|
||||
//todo: I think there is a missing index here, need to look at the search query section again as it was changed several times from the original schema creation
|
||||
|
||||
//create translation text tables
|
||||
await ExecQueryAsync("CREATE TABLE atranslation (id BIGSERIAL PRIMARY KEY, name varchar(255) not null, stock bool, cjkindex bool default false)");
|
||||
//LOOKAT: I don't think this is doing anything:
|
||||
//exec("CREATE UNIQUE INDEX atranslation_name_idx ON atranslation (name)");
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE atranslationitem (id BIGSERIAL PRIMARY KEY, translationid bigint not null REFERENCES atranslation (id), key text not null, display text not null)");
|
||||
|
||||
//LOOKAT: this is for what exactly??
|
||||
// exec("CREATE INDEX atranslationitem_translationid_key_idx ON atranslationitem (translationid,key)");
|
||||
//This seems more appropriate
|
||||
await ExecQueryAsync("CREATE INDEX atranslationitem_translationid_key_display_idx ON atranslationitem (translationid,key, display)");
|
||||
|
||||
//Load the default TRANSLATIONS
|
||||
@@ -244,6 +242,10 @@ namespace AyaNova.Util
|
||||
//LOOKAT: isn't this useless without the ID as well or is that not fetched?
|
||||
await ExecQueryAsync("CREATE INDEX afileattachment_storedfilename_idx ON afileattachment (storedfilename);");
|
||||
|
||||
//index for the common issue of checking if an object has an attachment and retrieving them
|
||||
//note always query (where clause) in this same order for best performance
|
||||
await ExecQueryAsync("CREATE INDEX afileattachment_typeid_idx ON afileattachment (attachtoobjectid, attachtoobjecttype );");
|
||||
|
||||
await SetSchemaLevelAsync(++currentSchema);
|
||||
}
|
||||
|
||||
@@ -313,10 +315,27 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// WikiPage table
|
||||
if (currentSchema < 11)
|
||||
{
|
||||
LogUpdateMessage(log);
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE awikipage (id BIGSERIAL PRIMARY KEY, " +
|
||||
"objectid bigint not null, objecttype integer not null, " +
|
||||
"content text)");
|
||||
|
||||
//INDEX: Most selective first as there is more unique ID's than unique types
|
||||
//to take advantage of this always query with where objectid=xx and objecttype=yy order
|
||||
await ExecQueryAsync("CREATE INDEX awikipage_typeid_idx ON awikipage (objectid, objectype );");
|
||||
|
||||
await SetSchemaLevelAsync(++currentSchema);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//MAKE SURE THE DESIRED SCHEMA WAS SET PROPERLY
|
||||
if (currentSchema > DESIRED_SCHEMA_LEVEL)
|
||||
throw new ArgumentOutOfRangeException("AySchema::DesiredSchemaLevel WASN'T SET PROPERLY");
|
||||
|
||||
|
||||
|
||||
@@ -333,7 +352,9 @@ namespace AyaNova.Util
|
||||
// }
|
||||
|
||||
|
||||
|
||||
//MAKE SURE THE DESIRED SCHEMA WAS SET PROPERLY
|
||||
if (currentSchema > DESIRED_SCHEMA_LEVEL)
|
||||
throw new ArgumentOutOfRangeException("AySchema::DesiredSchemaLevel WASN'T SET PROPERLY");
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user