This commit is contained in:
@@ -43,7 +43,7 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
else
|
||||
{
|
||||
newObject.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext();
|
||||
// newObject.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext();
|
||||
newObject.Tags = TagUtil.NormalizeTags(newObject.Tags);
|
||||
newObject.CustomFields = JsonUtil.CompactJson(newObject.CustomFields);
|
||||
await ct.Widget.AddAsync(newObject);
|
||||
@@ -67,7 +67,7 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
}
|
||||
Widget newObject = new Widget();
|
||||
CopyObject.Copy(dbObject, newObject, "Wiki");
|
||||
CopyObject.Copy(dbObject, newObject, "Wiki,Serial");
|
||||
string newUniqueName = string.Empty;
|
||||
bool NotUnique = true;
|
||||
long l = 1;
|
||||
@@ -77,7 +77,7 @@ namespace AyaNova.Biz
|
||||
NotUnique = await ct.Widget.AnyAsync(m => m.Name == newUniqueName);
|
||||
} while (NotUnique);
|
||||
newObject.Name = newUniqueName;
|
||||
newObject.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext();
|
||||
//newObject.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext();
|
||||
newObject.Id = 0;
|
||||
newObject.Concurrency = 0;
|
||||
await ct.Widget.AddAsync(newObject);
|
||||
@@ -112,7 +112,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
Widget SnapshotOfOriginalDBObj = new Widget();
|
||||
CopyObject.Copy(dbObject, SnapshotOfOriginalDBObj);
|
||||
CopyObject.Copy(putObject, dbObject, "Id,Serial");
|
||||
CopyObject.Copy(putObject, dbObject, "Id");//can update serial
|
||||
dbObject.Tags = TagUtil.NormalizeTags(dbObject.Tags);
|
||||
dbObject.CustomFields = JsonUtil.CompactJson(dbObject.CustomFields);
|
||||
ct.Entry(dbObject).OriginalValues["Concurrency"] = putObject.Concurrency;
|
||||
|
||||
@@ -137,6 +137,9 @@ namespace AyaNova.Models
|
||||
.HasForeignKey<Widget>(b => b.UserId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
|
||||
modelBuilder.Entity<Widget>().Property(z => z.Serial).UseIdentityByDefaultColumn();
|
||||
|
||||
// //Workorder
|
||||
// modelBuilder.Entity<WorkOrderItem>()
|
||||
// .HasOne(p => p.WorkOrder)
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace AyaNova.Util
|
||||
|
||||
//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 not null," +
|
||||
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," +
|
||||
"notes text, userid bigint null, wiki text null, customfields text, tags varchar(255) ARRAY)");
|
||||
|
||||
@@ -384,7 +384,7 @@ namespace AyaNova.Util
|
||||
|
||||
//----------
|
||||
//WORKORDER
|
||||
await ExecQueryAsync("CREATE TABLE aworkorder (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial bigint not null, active bool, " +
|
||||
await ExecQueryAsync("CREATE TABLE aworkorder (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial bigint generated by default as identity not null, active bool, " +
|
||||
"notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)");
|
||||
await ExecQueryAsync("CREATE INDEX aworkorder_serial_id_idx ON aworkorder (id, serial);");//is this necessary or fruitful?
|
||||
await ExecQueryAsync("CREATE INDEX aworkorder_tags ON aworkorder using GIN(tags)");
|
||||
|
||||
Reference in New Issue
Block a user