case 3999

This commit is contained in:
2021-10-14 23:19:12 +00:00
parent 29d98e4d77
commit 0a9d1fcbef
16 changed files with 46 additions and 85 deletions

2
.vscode/launch.json vendored
View File

@@ -52,7 +52,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "false", "AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -127,7 +127,7 @@ LEFT JOIN LATERAL
UiFieldDataType = (int)UiFieldDataType.Text, UiFieldDataType = (int)UiFieldDataType.Text,
AType = (int)AyaType.UnitModel, AType = (int)AyaType.UnitModel,
SqlIdColumnName = "aunitmodel.id", SqlIdColumnName = "aunitmodel.id",
SqlValueColumnName = "aunitmodel.number" SqlValueColumnName = "aunitmodel.name"
}); });
FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition

View File

@@ -10,28 +10,22 @@ namespace AyaNova.DataList
SQLFrom = "from aunitmodel left join avendor on (aunitmodel.vendorid=avendor.id)"; SQLFrom = "from aunitmodel left join avendor on (aunitmodel.vendorid=avendor.id)";
var RoleSet = BizRoles.GetRoleSet(DefaultListAType); var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
DefaultColumns = new List<string>() { "UnitModelModelNumber", "Name", "UnitModelVendorID", "Active" }; DefaultColumns = new List<string>() { "UnitModelName", "UnitModelVendorID", "Active" };
DefaultSortBy = new Dictionary<string, string>() { { "UnitModelModelNumber", "+" } }; DefaultSortBy = new Dictionary<string, string>() { { "UnitModelName", "+" } };
FieldDefinitions = new List<DataListFieldDefinition>(); FieldDefinitions = new List<DataListFieldDefinition>();
FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition
{ {
TKey = "UnitModelModelNumber", TKey = "UnitModelName",
FieldKey = "UnitModelModelNumber", FieldKey = "UnitModelName",
AType = (int)AyaType.UnitModel, AType = (int)AyaType.UnitModel,
UiFieldDataType = (int)UiFieldDataType.Text, UiFieldDataType = (int)UiFieldDataType.Text,
SqlIdColumnName = "aunitmodel.id", SqlIdColumnName = "aunitmodel.id",
SqlValueColumnName = "aunitmodel.number", SqlValueColumnName = "aunitmodel.name",
IsRowId = true IsRowId = true
}); });
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "Name",
FieldKey = "Name",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "aunitmodel.name"
});
FieldDefinitions.Add(new DataListFieldDefinition FieldDefinitions.Add(new DataListFieldDefinition
{ {

View File

@@ -15,12 +15,10 @@ namespace AyaNova.PickList
dynamic cm = null; dynamic cm = null;
cm = new JObject(); cm = new JObject();
cm.fld = "UnitModelModelNumber"; cm.fld = "UnitModelName";
dTemplate.Add(cm); dTemplate.Add(cm);
cm = new JObject();
cm.fld = "Name";
dTemplate.Add(cm);
cm = new JObject(); cm = new JObject();
cm.fld = "UnitModelVendorID"; cm.fld = "UnitModelVendorID";
@@ -45,22 +43,14 @@ namespace AyaNova.PickList
ColumnDefinitions.Add(new AyaPickListFieldDefinition ColumnDefinitions.Add(new AyaPickListFieldDefinition
{ {
TKey = "UnitModelModelNumber", TKey = "UnitModelName",
FieldKey = "UnitModelModelNumber", FieldKey = "UnitModelName",
ColumnDataType = UiFieldDataType.Text, ColumnDataType = UiFieldDataType.Text,
SqlIdColumnName = "aunitmodel.id", SqlIdColumnName = "aunitmodel.id",
SqlValueColumnName = "aunitmodel.number", SqlValueColumnName = "aunitmodel.name",
IsRowId = true IsRowId = true
}); });
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
TKey = "Name",
FieldKey = "Name",
ColumnDataType = UiFieldDataType.Text,
SqlValueColumnName = "aunitmodel.name"
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition ColumnDefinitions.Add(new AyaPickListFieldDefinition
{ {

View File

@@ -22,7 +22,7 @@ namespace AyaNova.PickList
dTemplate.Add(cm); dTemplate.Add(cm);
cm = new JObject(); cm = new JObject();
cm.fld = "UnitModelModelNumber"; cm.fld = "UnitModelName";
dTemplate.Add(cm); dTemplate.Add(cm);
cm = new JObject(); cm = new JObject();
@@ -56,15 +56,6 @@ namespace AyaNova.PickList
IsRowId = true IsRowId = true
}); });
ColumnDefinitions.Add(new AyaPickListFieldDefinition
{
FieldKey = "UnitModelModelNumber",
TKey = "UnitModelModelNumber",
ColumnDataType = UiFieldDataType.Text,
SqlIdColumnName = "aunitmodel.id",
SqlValueColumnName = "aunitmodel.number"
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition ColumnDefinitions.Add(new AyaPickListFieldDefinition
{ {
FieldKey = "UnitModelName", FieldKey = "UnitModelName",
@@ -74,6 +65,7 @@ namespace AyaNova.PickList
SqlValueColumnName = "aunitmodel.name" SqlValueColumnName = "aunitmodel.name"
}); });
ColumnDefinitions.Add(new AyaPickListFieldDefinition ColumnDefinitions.Add(new AyaPickListFieldDefinition
{ {
FieldKey = "UnitModelVendorID", FieldKey = "UnitModelVendorID",

View File

@@ -898,7 +898,6 @@ namespace AyaNova.Biz
//WORKORDER ITEM UNIT //WORKORDER ITEM UNIT
l.Add(new FormField { TKey = "WorkOrderItemUnitNotes", FieldKey = "WorkOrderItemUnitNotes", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "WorkOrderItemUnitNotes", FieldKey = "WorkOrderItemUnitNotes", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "Unit", FieldKey = "WorkOrderItemUnit", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "Unit", FieldKey = "WorkOrderItemUnit", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitModelModelNumber", FieldKey = "UnitModelModelNumber", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitModelVendorID", FieldKey = "UnitModelVendorID", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "UnitModelVendorID", FieldKey = "UnitModelVendorID", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitModelName", FieldKey = "UnitModelName", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "UnitModelName", FieldKey = "UnitModelName", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitDescription", FieldKey = "UnitDescription", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "UnitDescription", FieldKey = "UnitDescription", TKeySection = "WorkOrderItemUnit" });
@@ -1159,7 +1158,6 @@ namespace AyaNova.Biz
//WORKORDER ITEM UNIT //WORKORDER ITEM UNIT
l.Add(new FormField { TKey = "WorkOrderItemUnitNotes", FieldKey = "WorkOrderItemUnitNotes", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "WorkOrderItemUnitNotes", FieldKey = "WorkOrderItemUnitNotes", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "Unit", FieldKey = "WorkOrderItemUnit", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "Unit", FieldKey = "WorkOrderItemUnit", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitModelModelNumber", FieldKey = "UnitModelModelNumber", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitModelVendorID", FieldKey = "UnitModelVendorID", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "UnitModelVendorID", FieldKey = "UnitModelVendorID", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitModelName", FieldKey = "UnitModelName", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "UnitModelName", FieldKey = "UnitModelName", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitDescription", FieldKey = "UnitDescription", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "UnitDescription", FieldKey = "UnitDescription", TKeySection = "WorkOrderItemUnit" });
@@ -1452,7 +1450,6 @@ namespace AyaNova.Biz
//WORKORDER ITEM UNIT //WORKORDER ITEM UNIT
l.Add(new FormField { TKey = "WorkOrderItemUnitNotes", FieldKey = "WorkOrderItemUnitNotes", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "WorkOrderItemUnitNotes", FieldKey = "WorkOrderItemUnitNotes", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "Unit", FieldKey = "WorkOrderItemUnit", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "Unit", FieldKey = "WorkOrderItemUnit", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitModelModelNumber", FieldKey = "UnitModelModelNumber", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitModelVendorID", FieldKey = "UnitModelVendorID", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "UnitModelVendorID", FieldKey = "UnitModelVendorID", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitModelName", FieldKey = "UnitModelName", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "UnitModelName", FieldKey = "UnitModelName", TKeySection = "WorkOrderItemUnit" });
l.Add(new FormField { TKey = "UnitDescription", FieldKey = "UnitDescription", TKeySection = "WorkOrderItemUnit" }); l.Add(new FormField { TKey = "UnitDescription", FieldKey = "UnitDescription", TKeySection = "WorkOrderItemUnit" });

View File

@@ -4337,9 +4337,9 @@ namespace AyaNova.Biz
if (unitInfo.UnitModelId != null) if (unitInfo.UnitModelId != null)
{ {
var unitModelInfo = await ct.UnitModel.AsNoTracking().Where(x => x.Id == unitInfo.UnitModelId).Select(x => new { x.Name, x.VendorId, x.Number }).FirstOrDefaultAsync(); var unitModelInfo = await ct.UnitModel.AsNoTracking().Where(x => x.Id == unitInfo.UnitModelId).Select(x => new { x.Name, x.VendorId }).FirstOrDefaultAsync();
o.UnitModelNameViz = unitModelInfo.Name; o.UnitModelNameViz = unitModelInfo.Name;
o.UnitModelModelNumberViz = unitModelInfo.Number;
if (unitModelInfo.VendorId != null) if (unitModelInfo.VendorId != null)
o.UnitModelVendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == unitModelInfo.VendorId).Select(x => x.Name).FirstOrDefaultAsync(); o.UnitModelVendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == unitModelInfo.VendorId).Select(x => x.Name).FirstOrDefaultAsync();

View File

@@ -4652,9 +4652,9 @@ namespace AyaNova.Biz
if (unitInfo.UnitModelId != null) if (unitInfo.UnitModelId != null)
{ {
var unitModelInfo = await ct.UnitModel.AsNoTracking().Where(x => x.Id == unitInfo.UnitModelId).Select(x => new { x.Name, x.VendorId, x.Number }).FirstOrDefaultAsync(); var unitModelInfo = await ct.UnitModel.AsNoTracking().Where(x => x.Id == unitInfo.UnitModelId).Select(x => new { x.Name, x.VendorId }).FirstOrDefaultAsync();
o.UnitModelNameViz = unitModelInfo.Name; o.UnitModelNameViz = unitModelInfo.Name;
o.UnitModelModelNumberViz = unitModelInfo.Number;
if (unitModelInfo.VendorId != null) if (unitModelInfo.VendorId != null)
o.UnitModelVendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == unitModelInfo.VendorId).Select(x => x.Name).FirstOrDefaultAsync(); o.UnitModelVendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == unitModelInfo.VendorId).Select(x => x.Name).FirstOrDefaultAsync();

View File

@@ -213,8 +213,7 @@ namespace AyaNova.Biz
{ {
if (obj != null) if (obj != null)
searchParams.AddText(obj.Notes) searchParams.AddText(obj.Notes)
.AddText(obj.Name) .AddText(obj.Name)
.AddText(obj.Number)
.AddText(obj.UPC) .AddText(obj.UPC)
.AddText(obj.WarrantyTerms) .AddText(obj.WarrantyTerms)
.AddText(obj.Wiki) .AddText(obj.Wiki)
@@ -233,23 +232,21 @@ namespace AyaNova.Biz
bool isNew = currentObj == null; bool isNew = currentObj == null;
//## Name is not required nor required to be unique for a UnitModel so no validation for that here //Name required
//number is required but also not necessarily unique as two manufacturers could have the same model number for different products if (string.IsNullOrWhiteSpace(proposedObj.Name))
//However, a number and vendorid combo must be unique as it's considered that the same vendor would not have two models with identical numbers AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Number required
if (string.IsNullOrWhiteSpace(proposedObj.Number))
{
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Number");
return;//this is disqualifying outright so no need to check further rules
}
//If Number is otherwise OK, check CONSTRAINT UNQ_UnitModelNumberVendorId UNIQUE (number, vendorid) //If name is otherwise OK, check that name is unique
if (await ct.UnitModel.AnyAsync(m => m.Number == proposedObj.Number && m.VendorId == proposedObj.VendorId && m.Id != proposedObj.Id)) if (!PropertyHasErrors("Name"))
{ {
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Number", "Model number + Vendor must be unique"); //Use Any command is efficient way to check existance, it doesn't return the record, just a true or false
return;//this is disqualifying outright so no need to check further rules if (await ct.UnitModel.AnyAsync(z => z.Name == proposedObj.Name && z.Id != proposedObj.Id))
{
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Name");
}
} }
//Any form customizations to validate? //Any form customizations to validate?
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.UnitModel.ToString()); var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.UnitModel.ToString());

View File

@@ -6063,9 +6063,8 @@ namespace AyaNova.Biz
} }
if (unitInfo.UnitModelId != null) if (unitInfo.UnitModelId != null)
{ {
var unitModelInfo = await ct.UnitModel.AsNoTracking().Where(x => x.Id == unitInfo.UnitModelId).Select(x => new { x.Name, x.VendorId, x.Number }).FirstOrDefaultAsync(); var unitModelInfo = await ct.UnitModel.AsNoTracking().Where(x => x.Id == unitInfo.UnitModelId).Select(x => new { x.Name, x.VendorId }).FirstOrDefaultAsync();
o.UnitModelNameViz = unitModelInfo.Name; o.UnitModelNameViz = unitModelInfo.Name;
o.UnitModelModelNumberViz = unitModelInfo.Number;
if (unitModelInfo.VendorId != null) if (unitModelInfo.VendorId != null)
o.UnitModelVendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == unitModelInfo.VendorId).Select(x => x.Name).FirstOrDefaultAsync(); o.UnitModelVendorViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == unitModelInfo.VendorId).Select(x => x.Name).FirstOrDefaultAsync();

View File

@@ -29,8 +29,7 @@ namespace AyaNova.Models
public string UnitModelNameViz { get; set; } public string UnitModelNameViz { get; set; }
[NotMapped] [NotMapped]
public string UnitModelVendorViz { get; set; } public string UnitModelVendorViz { get; set; }
[NotMapped]
public string UnitModelModelNumberViz { get; set; }
[NotMapped] [NotMapped]
public string UnitDescriptionViz { get; set; } public string UnitDescriptionViz { get; set; }

View File

@@ -29,8 +29,7 @@ namespace AyaNova.Models
public string UnitModelNameViz { get; set; } public string UnitModelNameViz { get; set; }
[NotMapped] [NotMapped]
public string UnitModelVendorViz { get; set; } public string UnitModelVendorViz { get; set; }
[NotMapped]
public string UnitModelModelNumberViz { get; set; }
[NotMapped] [NotMapped]
public string UnitDescriptionViz { get; set; } public string UnitDescriptionViz { get; set; }

View File

@@ -15,7 +15,7 @@ namespace AyaNova.Models
public long Id { get; set; } public long Id { get; set; }
public uint Concurrency { get; set; } public uint Concurrency { get; set; }
[Required]
public string Name { get; set; } public string Name { get; set; }
public bool Active { get; set; } public bool Active { get; set; }
public string Notes { get; set; } public string Notes { get; set; }
@@ -23,8 +23,6 @@ namespace AyaNova.Models
public string CustomFields { get; set; } public string CustomFields { get; set; }
public List<string> Tags { get; set; } public List<string> Tags { get; set; }
[Required]
public string Number { get; set; }
public long? VendorId { get; set; } public long? VendorId { get; set; }
[NotMapped] [NotMapped]
public string VendorViz { get; set; } public string VendorViz { get; set; }

View File

@@ -29,8 +29,7 @@ namespace AyaNova.Models
public string UnitModelNameViz { get; set; } public string UnitModelNameViz { get; set; }
[NotMapped] [NotMapped]
public string UnitModelVendorViz { get; set; } public string UnitModelVendorViz { get; set; }
[NotMapped]
public string UnitModelModelNumberViz { get; set; }
[NotMapped] [NotMapped]
public string UnitDescriptionViz { get; set; } public string UnitDescriptionViz { get; set; }
[NotMapped] [NotMapped]

View File

@@ -22,8 +22,8 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!! //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 1; private const int DESIRED_SCHEMA_LEVEL = 1;
internal const long EXPECTED_COLUMN_COUNT = 1301; internal const long EXPECTED_COLUMN_COUNT = 1300;
internal const long EXPECTED_INDEX_COUNT = 147; internal const long EXPECTED_INDEX_COUNT = 146;
internal const long EXPECTED_CHECK_CONSTRAINTS = 517; internal const long EXPECTED_CHECK_CONSTRAINTS = 517;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 193; internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 193;
internal const long EXPECTED_VIEWS = 11; internal const long EXPECTED_VIEWS = 11;
@@ -31,7 +31,7 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!! //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
///////////////////////////////////////////////////////////////// C1301:I147:CC517:FC193:V11:R2 ///////////////////////////////////////////////////////////////// C1300:I146:CC517:FC193:V11:R2
@@ -399,7 +399,7 @@ BEGIN
when 29 then return 'LT:WorkOrderItemLoan'; when 29 then return 'LT:WorkOrderItemLoan';
when 30 then return 'LT:WorkOrderItemPart'; when 30 then return 'LT:WorkOrderItemPart';
when 31 then aytable = 'aunit'; aynamecolumn = 'serial'; when 31 then aytable = 'aunit'; aynamecolumn = 'serial';
when 32 then aytable = 'aunitmodel'; aynamecolumn = 'number'; when 32 then aytable = 'aunitmodel'; aynamecolumn = 'name';
when 33 then aytable = 'avendor'; when 33 then aytable = 'avendor';
when 34 then aytable = 'aworkorder'; aynamecolumn = 'serial'; when 34 then aytable = 'aworkorder'; aynamecolumn = 'serial';
when 35 then return 'LT:WorkOrderItem'; when 35 then return 'LT:WorkOrderItem';
@@ -732,10 +732,10 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//UNITMODEL //UNITMODEL
await ExecQueryAsync("CREATE TABLE aunitmodel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NULL, active BOOL NOT NULL, " await ExecQueryAsync("CREATE TABLE aunitmodel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, active BOOL NOT NULL, "
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, " + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, "
+ "number TEXT NOT NULL, vendorid BIGINT NULL REFERENCES avendor(id), upc TEXT NULL, lifetimewarranty BOOL NOT NULL, introduceddate TIMESTAMP NULL, " + "vendorid BIGINT NULL REFERENCES avendor(id), upc TEXT NULL, lifetimewarranty BOOL NOT NULL, introduceddate TIMESTAMP NULL, "
+ "discontinued BOOL NOT NULL, discontinueddate TIMESTAMP NULL, warrantylength INTEGER NULL, warrantyterms TEXT NULL, CONSTRAINT UNQ_UnitModelNumberVendorId UNIQUE (number, vendorid) " + "discontinued BOOL NOT NULL, discontinueddate TIMESTAMP NULL, warrantylength INTEGER NULL, warrantyterms TEXT NULL "
+ ")"); + ")");

View File

@@ -2143,13 +2143,10 @@ namespace AyaNova.Util
do do
{ {
o.Name = $"{Fake.Vehicle.Model()} {Fake.Commerce.Categories(1)[0]}"; o.Name = $"{Fake.Vehicle.Model()} {Fake.Commerce.Categories(1)[0]} - {Fake.Finance.Account(6)}";
} while (!HashUnitModelNames.Add(o.Name)); } while (!HashUnitModelNames.Add(o.Name));
do
{
o.Number = Fake.Finance.Account(6);
} while (!HashUnitModelNames.Add(o.Number));
o.Active = true; o.Active = true;
o.Notes = Fake.Lorem.Sentence(); o.Notes = Fake.Lorem.Sentence();