This commit is contained in:
2020-11-10 19:30:50 +00:00
parent 06e1604b0f
commit 010aa16574
24 changed files with 94 additions and 99 deletions

View File

@@ -207,9 +207,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -207,9 +207,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -233,10 +233,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(inObj.Name)) if (string.IsNullOrWhiteSpace(inObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (inObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))
{ {

View File

@@ -207,9 +207,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -207,10 +207,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))
{ {

View File

@@ -237,9 +237,6 @@ namespace AyaNova.Biz
// if (string.IsNullOrWhiteSpace(proposedObj.Name)) // if (string.IsNullOrWhiteSpace(proposedObj.Name))
// AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); // AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
// //Name must be less than 255 characters
// if (proposedObj.Name.Length > 255)
// AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
// //If name is otherwise OK, check that name is unique // //If name is otherwise OK, check that name is unique
// if (!PropertyHasErrors("Name")) // if (!PropertyHasErrors("Name"))

View File

@@ -257,9 +257,7 @@ namespace AyaNova.Biz
// if (string.IsNullOrWhiteSpace(proposedObj.Name)) // if (string.IsNullOrWhiteSpace(proposedObj.Name))
// AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); // AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
// //Name must be less than 255 characters
// if (proposedObj.Name.Length > 255)
// AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
// //If name is otherwise OK, check that name is unique // //If name is otherwise OK, check that name is unique
// if (!PropertyHasErrors("Name")) // if (!PropertyHasErrors("Name"))

View File

@@ -222,10 +222,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))
{ {

View File

@@ -207,9 +207,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -207,9 +207,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -205,9 +205,6 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -264,10 +264,7 @@ namespace AyaNova.Biz
// if (string.IsNullOrWhiteSpace(proposedObj.Name)) // if (string.IsNullOrWhiteSpace(proposedObj.Name))
// AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); // AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
// //Name must be less than 255 characters
// if (proposedObj.Name.Length > 255)
// AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
// //If name is otherwise OK, check that name is unique // //If name is otherwise OK, check that name is unique
// if (!PropertyHasErrors("Name")) // if (!PropertyHasErrors("Name"))
// { // {

View File

@@ -240,9 +240,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -282,9 +282,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -354,9 +354,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 char max");
//Name must be unique //Name must be unique
if (await ct.Translation.AnyAsync(z => z.Name == proposedObj.Name && z.Id != proposedObj.Id)) if (await ct.Translation.AnyAsync(z => z.Name == proposedObj.Name && z.Id != proposedObj.Id))

View File

@@ -205,9 +205,6 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -205,9 +205,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -423,9 +423,6 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))

View File

@@ -205,10 +205,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))
{ {

View File

@@ -234,10 +234,6 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))
{ {

View File

@@ -342,9 +342,6 @@ namespace AyaNova.Biz
// if (string.IsNullOrWhiteSpace(proposedObj.Name)) // if (string.IsNullOrWhiteSpace(proposedObj.Name))
// AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); // AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
// //Name must be less than 255 characters
// if (proposedObj.Name.Length > 255)
// AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
// //If name is otherwise OK, check that name is unique // //If name is otherwise OK, check that name is unique
// if (!PropertyHasErrors("Name")) // if (!PropertyHasErrors("Name"))

View File

@@ -242,10 +242,6 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name)) if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be less than 255 characters
if (proposedObj.Name.Length > 255)
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "Name", "255 max");
//If name is otherwise OK, check that name is unique //If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name")) if (!PropertyHasErrors("Name"))
{ {

View File

@@ -24,9 +24,18 @@ namespace AyaNova.Models
public List<string> Tags { get; set; } public List<string> Tags { get; set; }
[Url]
public string WebAddress { get; set; }
public string PopUpNotes { get; set; }
public bool BillHeadOffice { get; set; }
public long HeadOfficeID { get; set; }
public string TechNotes { get; set; }
public Customer() public Customer()
{ {
Tags = new List<string>(); Tags = new List<string>();
BillHeadOffice = false;
} }
[NotMapped, JsonIgnore] [NotMapped, JsonIgnore]
@@ -35,3 +44,47 @@ namespace AyaNova.Models
}//eoc }//eoc
}//eons }//eons
/*
[AID] [uniqueidentifier] NOT NULL,
[ANAME] [nvarchar](255) NOT NULL,
[ACREATED] [datetime] NULL,
[AMODIFIED] [datetime] NULL,
[AACTIVE] [bit] NOT NULL,
[ACREATOR] [uniqueidentifier] NULL,
[AMODIFIER] [uniqueidentifier] NULL,
[ADISPATCHZONEID] [uniqueidentifier] NULL,
[AWEBADDRESS] [nvarchar](255) NULL,
[APOPUPNOTES] [ntext] NULL,
[ACLIENTGROUPID] [uniqueidentifier] NULL,
[ABILLHEADOFFICE] [bit] NOT NULL,
[AHEADOFFICEID] [uniqueidentifier] NULL,
[ANOTES] [ntext] NULL,
[AREGIONID] [uniqueidentifier] NULL,
[ATECHNOTES] [ntext] NULL,
[AACCOUNTNUMBER] [nvarchar](255) NULL,
[ACUSTOM1] [ntext] NULL,
[ACUSTOM2] [ntext] NULL,
[ACUSTOM3] [ntext] NULL,
[ACUSTOM4] [ntext] NULL,
[ACUSTOM5] [ntext] NULL,
[ACUSTOM6] [ntext] NULL,
[ACUSTOM7] [ntext] NULL,
[ACUSTOM8] [ntext] NULL,
[ACUSTOM9] [ntext] NULL,
[ACUSTOM0] [ntext] NULL,
[AUSESBANKING] [bit] NOT NULL,
[ACONTRACTID] [uniqueidentifier] NULL,
[ACONTRACTEXPIRES] [datetime] NULL,
[ALASTWORKORDERID] [uniqueidentifier] NULL,
[ALASTSERVICEDATE] [datetime] NULL,
[ADEFAULTSERVICETEMPLATEID] [uniqueidentifier] NULL,
[ACONTACTNOTES] [ntext] NULL,
[ACONTACT] [nvarchar](500) NULL,
[APHONE1] [nvarchar](255) NULL,
[APHONE2] [nvarchar](255) NULL,
[APHONE3] [nvarchar](255) NULL,
[APHONE4] [nvarchar](255) NULL,
[APHONE5] [nvarchar](255) NULL,
[AEMAIL] [nvarchar](255) NULL,
[ASENDNOTIFICATIONS] [bit] NOT NULL,
*/

View File

@@ -316,7 +316,7 @@ $BODY$;
"); ");
//create translation text tables //create translation text tables
await ExecQueryAsync("CREATE TABLE atranslation (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null, stock bool, cjkindex bool default false)"); await ExecQueryAsync("CREATE TABLE atranslation (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null, stock bool, cjkindex bool default false)");
await ExecQueryAsync("CREATE TABLE atranslationitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, translationid bigint not null REFERENCES atranslation (id), key text not null, display text not null)"); await ExecQueryAsync("CREATE TABLE atranslationitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, translationid bigint not null REFERENCES atranslation (id), key text not null, display text not null)");
//This is not a well used index, not sure what it's point is //This is not a well used index, not sure what it's point is
@@ -327,7 +327,7 @@ $BODY$;
//Add user table //Add user table
await ExecQueryAsync("CREATE TABLE auser (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, active bool not null, name varchar(255) not null unique, " + await ExecQueryAsync("CREATE TABLE auser (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, active bool not null, name text not null unique, " +
"lastlogin timestamp, login text not null unique, password text not null, salt text not null, roles integer not null, currentauthtoken text, " + "lastlogin timestamp, login text not null unique, password text not null, salt text not null, roles integer not null, currentauthtoken text, " +
"dlkey text, dlkeyexpire timestamp, usertype integer not null, employeenumber varchar(255), notes text, customerid bigint, " + "dlkey text, dlkeyexpire timestamp, usertype integer not null, employeenumber varchar(255), notes text, customerid bigint, " +
"headofficeid bigint, subvendorid bigint, wiki text, customfields text, tags varchar(255) ARRAY)"); "headofficeid bigint, subvendorid bigint, wiki text, customfields text, tags varchar(255) ARRAY)");
@@ -369,7 +369,7 @@ $BODY$;
//Add widget table //Add widget table
//id, text, longtext, boolean, currency, //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," + await ExecQueryAsync("CREATE TABLE awidget (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, serial bigint generated by default as identity not null," +
"startdate timestamp, enddate timestamp, dollaramount decimal(19,4), active bool, usertype int4, count integer," + "startdate timestamp, enddate timestamp, dollaramount decimal(19,4), active bool, usertype int4, count integer," +
"notes text, userid bigint, wiki text, customfields text, tags varchar(255) ARRAY)"); "notes text, userid bigint, wiki text, customfields text, tags varchar(255) ARRAY)");
@@ -431,7 +431,7 @@ $BODY$;
{ {
LogUpdateMessage(log); LogUpdateMessage(log);
await ExecQueryAsync("CREATE TABLE adatalistview (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null, name varchar(255) not null unique, public bool not null," + await ExecQueryAsync("CREATE TABLE adatalistview (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null, name text not null unique, public bool not null," +
"listkey varchar(255) not null, listview text)"); "listkey varchar(255) not null, listview text)");
await SetSchemaLevelAsync(++currentSchema); await SetSchemaLevelAsync(++currentSchema);
@@ -443,7 +443,7 @@ $BODY$;
if (currentSchema < 8) if (currentSchema < 8)
{ {
LogUpdateMessage(log); LogUpdateMessage(log);
await ExecQueryAsync("CREATE TABLE atag (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, refcount bigint not null)"); await ExecQueryAsync("CREATE TABLE atag (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, refcount bigint not null)");
await SetSchemaLevelAsync(++currentSchema); await SetSchemaLevelAsync(++currentSchema);
} }
@@ -482,61 +482,61 @@ $BODY$;
LogUpdateMessage(log); LogUpdateMessage(log);
//CUSTOMER //CUSTOMER
await ExecQueryAsync("CREATE TABLE acustomer (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE acustomer (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY)"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY)");
await ExecQueryAsync("CREATE UNIQUE INDEX acustomer_name_id_idx ON acustomer (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX acustomer_name_id_idx ON acustomer (id, name);");
await ExecQueryAsync("CREATE INDEX acustomer_tags ON acustomer using GIN(tags)"); await ExecQueryAsync("CREATE INDEX acustomer_tags ON acustomer using GIN(tags)");
//CONTRACT //CONTRACT
await ExecQueryAsync("CREATE TABLE acontract (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE acontract (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX acontract_name_id_idx ON acontract (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX acontract_name_id_idx ON acontract (id, name);");
await ExecQueryAsync("CREATE INDEX acontract_tags ON acontract using GIN(tags)"); await ExecQueryAsync("CREATE INDEX acontract_tags ON acontract using GIN(tags)");
//HEADOFFICE //HEADOFFICE
await ExecQueryAsync("CREATE TABLE aheadoffice (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aheadoffice (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aheadoffice_name_id_idx ON aheadoffice (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aheadoffice_name_id_idx ON aheadoffice (id, name);");
await ExecQueryAsync("CREATE INDEX aheadoffice_tags ON aheadoffice using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aheadoffice_tags ON aheadoffice using GIN(tags)");
//LOANUNIT //LOANUNIT
await ExecQueryAsync("CREATE TABLE aloanunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aloanunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aloanunit_name_id_idx ON aloanunit (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aloanunit_name_id_idx ON aloanunit (id, name);");
await ExecQueryAsync("CREATE INDEX aloanunit_tags ON aloanunit using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aloanunit_tags ON aloanunit using GIN(tags)");
//PART //PART
await ExecQueryAsync("CREATE TABLE apart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE apart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX apart_name_id_idx ON apart (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX apart_name_id_idx ON apart (id, name);");
await ExecQueryAsync("CREATE INDEX apart_tags ON apart using GIN(tags)"); await ExecQueryAsync("CREATE INDEX apart_tags ON apart using GIN(tags)");
//PROJECT //PROJECT
await ExecQueryAsync("CREATE TABLE aproject (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aproject (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aproject_name_id_idx ON aproject (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aproject_name_id_idx ON aproject (id, name);");
await ExecQueryAsync("CREATE INDEX aproject_tags ON aproject using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aproject_tags ON aproject using GIN(tags)");
//PURCHASEORDER //PURCHASEORDER
await ExecQueryAsync("CREATE TABLE apurchaseorder (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE apurchaseorder (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX apurchaseorder_name_id_idx ON apurchaseorder (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX apurchaseorder_name_id_idx ON apurchaseorder (id, name);");
await ExecQueryAsync("CREATE INDEX apurchaseorder_tags ON apurchaseorder using GIN(tags)"); await ExecQueryAsync("CREATE INDEX apurchaseorder_tags ON apurchaseorder using GIN(tags)");
//UNIT //UNIT
await ExecQueryAsync("CREATE TABLE aunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aunit_name_id_idx ON aunit (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aunit_name_id_idx ON aunit (id, name);");
await ExecQueryAsync("CREATE INDEX aunit_tags ON aunit using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aunit_tags ON aunit using GIN(tags)");
//UNITMODEL //UNITMODEL
await ExecQueryAsync("CREATE TABLE aunitmodel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aunitmodel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aunitmodel_name_id_idx ON aunitmodel (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aunitmodel_name_id_idx ON aunitmodel (id, name);");
await ExecQueryAsync("CREATE INDEX aunitmodel_tags ON aunitmodel using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aunitmodel_tags ON aunitmodel using GIN(tags)");
//VENDOR //VENDOR
await ExecQueryAsync("CREATE TABLE avendor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE avendor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX avendor_name_id_idx ON avendor (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX avendor_name_id_idx ON avendor (id, name);");
await ExecQueryAsync("CREATE INDEX avendor_tags ON avendor using GIN(tags)"); await ExecQueryAsync("CREATE INDEX avendor_tags ON avendor using GIN(tags)");
@@ -613,13 +613,13 @@ $BODY$;
//WORKORDERTEMPLATE //WORKORDERTEMPLATE
await ExecQueryAsync("CREATE TABLE aworkordertemplate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aworkordertemplate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aworkordertemplate_name_id_idx ON aworkordertemplate (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aworkordertemplate_name_id_idx ON aworkordertemplate (id, name);");
await ExecQueryAsync("CREATE INDEX aworkordertemplate_tags ON aworkordertemplate using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aworkordertemplate_tags ON aworkordertemplate using GIN(tags)");
//WORKORDERTEMPLATEITEM //WORKORDERTEMPLATEITEM
await ExecQueryAsync("CREATE TABLE aworkordertemplateitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aworkordertemplateitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aworkordertemplateitem_name_id_idx ON aworkordertemplateitem (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aworkordertemplateitem_name_id_idx ON aworkordertemplateitem (id, name);");
await ExecQueryAsync("CREATE INDEX aworkordertemplateitem_tags ON aworkordertemplateitem using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aworkordertemplateitem_tags ON aworkordertemplateitem using GIN(tags)");
@@ -631,19 +631,19 @@ $BODY$;
await ExecQueryAsync("CREATE INDEX aquote_tags ON aquote using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aquote_tags ON aquote using GIN(tags)");
//QUOTEITEM //QUOTEITEM
await ExecQueryAsync("CREATE TABLE aquoteitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, quoteid bigint not null REFERENCES aquote (id), name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aquoteitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, quoteid bigint not null REFERENCES aquote (id), name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aquoteitem_name_id_idx ON aquoteitem (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aquoteitem_name_id_idx ON aquoteitem (id, name);");
await ExecQueryAsync("CREATE INDEX aquoteitem_tags ON aquoteitem using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aquoteitem_tags ON aquoteitem using GIN(tags)");
//QUOTETEMPLATE //QUOTETEMPLATE
await ExecQueryAsync("CREATE TABLE aquotetemplate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aquotetemplate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aquotetemplate_name_id_idx ON aquotetemplate (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aquotetemplate_name_id_idx ON aquotetemplate (id, name);");
await ExecQueryAsync("CREATE INDEX aquotetemplate_tags ON aquotetemplate using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aquotetemplate_tags ON aquotetemplate using GIN(tags)");
//QUOTETEMPLATEITEM //QUOTETEMPLATEITEM
await ExecQueryAsync("CREATE TABLE aquotetemplateitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE aquotetemplateitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aquotetemplateitem_name_id_idx ON aquotetemplateitem (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX aquotetemplateitem_name_id_idx ON aquotetemplateitem (id, name);");
await ExecQueryAsync("CREATE INDEX aquotetemplateitem_tags ON aquotetemplateitem using GIN(tags)"); await ExecQueryAsync("CREATE INDEX aquotetemplateitem_tags ON aquotetemplateitem using GIN(tags)");
@@ -655,19 +655,19 @@ $BODY$;
await ExecQueryAsync("CREATE INDEX apm_tags ON apm using GIN(tags)"); await ExecQueryAsync("CREATE INDEX apm_tags ON apm using GIN(tags)");
//PMITEM //PMITEM
await ExecQueryAsync("CREATE TABLE apmitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmid bigint not null REFERENCES apm (id), name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE apmitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmid bigint not null REFERENCES apm (id), name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX apmitem_name_id_idx ON apmitem (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX apmitem_name_id_idx ON apmitem (id, name);");
await ExecQueryAsync("CREATE INDEX apmitem_tags ON apmitem using GIN(tags)"); await ExecQueryAsync("CREATE INDEX apmitem_tags ON apmitem using GIN(tags)");
//PMTEMPLATE //PMTEMPLATE
await ExecQueryAsync("CREATE TABLE apmtemplate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE apmtemplate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX apmtemplate_name_id_idx ON apmtemplate (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX apmtemplate_name_id_idx ON apmtemplate (id, name);");
await ExecQueryAsync("CREATE INDEX apmtemplate_tags ON apmtemplate using GIN(tags)"); await ExecQueryAsync("CREATE INDEX apmtemplate_tags ON apmtemplate using GIN(tags)");
//PMTEMPLATEITEM //PMTEMPLATEITEM
await ExecQueryAsync("CREATE TABLE apmtemplateitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE apmtemplateitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX apmtemplateitem_name_id_idx ON apmtemplateitem (id, name);"); await ExecQueryAsync("CREATE UNIQUE INDEX apmtemplateitem_name_id_idx ON apmtemplateitem (id, name);");
await ExecQueryAsync("CREATE INDEX apmtemplateitem_tags ON apmtemplateitem using GIN(tags)"); await ExecQueryAsync("CREATE INDEX apmtemplateitem_tags ON apmtemplateitem using GIN(tags)");
@@ -690,12 +690,12 @@ $BODY$;
"deliveryaddress text, linkreportid bigint not null, tags varchar(255) ARRAY)"); "deliveryaddress text, linkreportid bigint not null, tags varchar(255) ARRAY)");
await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " + await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " +
"ayatype integer not null, objectid bigint not null, name varchar(255) not null, eventtype integer not null, notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, " + "ayatype integer not null, objectid bigint not null, name text not null, eventtype integer not null, notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, " +
"userid bigint not null REFERENCES auser (id), idvalue bigint not null, decvalue decimal(19,4) not null, eventdate timestamp not null, message text)"); "userid bigint not null REFERENCES auser (id), idvalue bigint not null, decvalue decimal(19,4) not null, eventdate timestamp not null, message text)");
await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null REFERENCES auser (id), " + await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null REFERENCES auser (id), " +
"created timestamp not null, ayatype integer not null, objectid bigint not null, name varchar(255) not null, eventtype integer not null, " + "created timestamp not null, ayatype integer not null, objectid bigint not null, name text not null, eventtype integer not null, " +
"notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, message text, fetched bool not null)"); "notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, message text, fetched bool not null)");
await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed timestamp not null, " + await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed timestamp not null, " +
@@ -722,7 +722,7 @@ $BODY$;
if (currentSchema < 14) if (currentSchema < 14)
{ {
LogUpdateMessage(log); LogUpdateMessage(log);
await ExecQueryAsync("CREATE TABLE areport (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name varchar(255) not null unique, active bool, " + await ExecQueryAsync("CREATE TABLE areport (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, roles integer not null, objecttype integer not null, template text, style text, jsprerender text, jshelpers text, rendertype integer not null, " + "notes text, roles integer not null, objecttype integer not null, template text, style text, jsprerender text, jshelpers text, rendertype integer not null, " +
"headertemplate text, footertemplate text, displayheaderfooter bool, paperformat integer not null, landscape bool, marginoptionsbottom text, " + "headertemplate text, footertemplate text, displayheaderfooter bool, paperformat integer not null, landscape bool, marginoptionsbottom text, " +
"marginoptionsleft text, marginoptionsright text, marginoptionstop text, pageranges text, prefercsspagesize bool, printbackground bool, scale decimal(19,4) )"); "marginoptionsleft text, marginoptionsright text, marginoptionstop text, pageranges text, prefercsspagesize bool, printbackground bool, scale decimal(19,4) )");