//
using System;
using IoTSharp.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace IoTSharp.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20220212100327_FixTenantInfo")]
partial class FixTenantInfo
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("IoTSharp.Data.AuditLog", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ActionData")
.HasColumnType("jsonb");
b.Property("ActionName")
.HasColumnType("text");
b.Property("ActionResult")
.HasColumnType("jsonb");
b.Property("ActiveDateTime")
.HasColumnType("timestamp with time zone");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("ObjectID")
.HasColumnType("uuid");
b.Property("ObjectName")
.HasColumnType("text");
b.Property("ObjectType")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("UserId")
.HasColumnType("text");
b.Property("UserName")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.HasIndex("TenantId");
b.ToTable("AuditLog");
});
modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AuthToken")
.HasColumnType("text");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("Name")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("CustomerId");
b.HasIndex("TenantId");
b.ToTable("AuthorizedKeys");
});
modelBuilder.Entity("IoTSharp.Data.BaseDictionary", b =>
{
b.Property("DictionaryId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DictionaryId"));
b.Property("Dictionary18NKeyName")
.HasColumnType("text");
b.Property("DictionaryColor")
.HasColumnType("text");
b.Property("DictionaryDesc")
.HasColumnType("text");
b.Property("DictionaryGroupId")
.HasColumnType("bigint");
b.Property("DictionaryIcon")
.HasColumnType("text");
b.Property("DictionaryName")
.HasColumnType("text");
b.Property("DictionaryPattern")
.HasColumnType("text");
b.Property("DictionaryStatus")
.HasColumnType("integer");
b.Property("DictionaryTag")
.HasColumnType("text");
b.Property("DictionaryValue")
.HasColumnType("text");
b.Property("DictionaryValueType")
.HasColumnType("integer");
b.Property("DictionaryValueTypeName")
.HasColumnType("text");
b.HasKey("DictionaryId");
b.ToTable("BaseDictionaries");
});
modelBuilder.Entity("IoTSharp.Data.BaseDictionaryGroup", b =>
{
b.Property("DictionaryGroupId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DictionaryGroupId"));
b.Property("DictionaryGroup18NKeyName")
.HasColumnType("text");
b.Property("DictionaryGroupDesc")
.HasColumnType("text");
b.Property("DictionaryGroupKey")
.HasColumnType("text");
b.Property("DictionaryGroupName")
.HasColumnType("text");
b.Property("DictionaryGroupStatus")
.HasColumnType("integer");
b.Property("DictionaryGroupValueType")
.HasColumnType("integer");
b.Property("DictionaryGroupValueTypeName")
.HasColumnType("text");
b.HasKey("DictionaryGroupId");
b.ToTable("BaseDictionaryGroups");
});
modelBuilder.Entity("IoTSharp.Data.BaseEvent", b =>
{
b.Property("EventId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("BizData")
.HasColumnType("text");
b.Property("Bizid")
.HasColumnType("text");
b.Property("CreaterDateTime")
.HasColumnType("timestamp with time zone");
b.Property("Creator")
.HasColumnType("uuid");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("EventDesc")
.HasColumnType("text");
b.Property("EventName")
.HasColumnType("text");
b.Property("EventStaus")
.HasColumnType("integer");
b.Property("FlowRuleRuleId")
.HasColumnType("uuid");
b.Property("MataData")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("Type")
.HasColumnType("integer");
b.HasKey("EventId");
b.HasIndex("CustomerId");
b.HasIndex("FlowRuleRuleId");
b.HasIndex("TenantId");
b.ToTable("BaseEvents");
});
modelBuilder.Entity("IoTSharp.Data.BaseI18N", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AddDate")
.HasColumnType("timestamp with time zone");
b.Property("KeyName")
.HasColumnType("text");
b.Property("ResouceDesc")
.HasColumnType("text");
b.Property("ResouceGroupId")
.HasColumnType("integer");
b.Property("ResourceId")
.HasColumnType("bigint");
b.Property("ResourceKey")
.HasColumnType("text");
b.Property("ResourceTag")
.HasColumnType("text");
b.Property("ResourceType")
.HasColumnType("integer");
b.Property("Status")
.HasColumnType("integer");
b.Property("UserId")
.HasColumnType("uuid");
b.Property("ValueBG")
.HasColumnType("text");
b.Property("ValueCS")
.HasColumnType("text");
b.Property("ValueDA")
.HasColumnType("text");
b.Property("ValueDEDE")
.HasColumnType("text");
b.Property("ValueELGR")
.HasColumnType("text");
b.Property("ValueENGR")
.HasColumnType("text");
b.Property("ValueENUS")
.HasColumnType("text");
b.Property("ValueESES")
.HasColumnType("text");
b.Property("ValueFI")
.HasColumnType("text");
b.Property("ValueFRFR")
.HasColumnType("text");
b.Property("ValueHE")
.HasColumnType("text");
b.Property("ValueHRHR")
.HasColumnType("text");
b.Property("ValueHU")
.HasColumnType("text");
b.Property("ValueITIT")
.HasColumnType("text");
b.Property("ValueJAJP")
.HasColumnType("text");
b.Property("ValueKOKR")
.HasColumnType("text");
b.Property("ValueNL")
.HasColumnType("text");
b.Property("ValuePLPL")
.HasColumnType("text");
b.Property("ValuePT")
.HasColumnType("text");
b.Property("ValueSLSL")
.HasColumnType("text");
b.Property("ValueSR")
.HasColumnType("text");
b.Property("ValueSV")
.HasColumnType("text");
b.Property("ValueTRTR")
.HasColumnType("text");
b.Property("ValueUK")
.HasColumnType("text");
b.Property("ValueVI")
.HasColumnType("text");
b.Property("ValueZHCN")
.HasColumnType("text");
b.Property("ValueZHTW")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("BaseI18Ns");
});
modelBuilder.Entity("IoTSharp.Data.Customer", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Address")
.HasColumnType("text");
b.Property("City")
.HasColumnType("text");
b.Property("Country")
.HasColumnType("text");
b.Property("Email")
.HasColumnType("text");
b.Property("Name")
.HasColumnType("text");
b.Property("Phone")
.HasColumnType("text");
b.Property("Province")
.HasColumnType("text");
b.Property("Street")
.HasColumnType("text");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("ZipCode")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("Customer");
});
modelBuilder.Entity("IoTSharp.Data.DataStorage", b =>
{
b.Property("Catalog")
.HasColumnType("integer")
.HasColumnOrder(0);
b.Property("DeviceId")
.HasColumnType("uuid")
.HasColumnOrder(1);
b.Property("KeyName")
.HasColumnType("text")
.HasColumnOrder(2);
b.Property("DataSide")
.HasColumnType("integer")
.HasColumnOrder(4);
b.Property("DateTime")
.HasColumnType("timestamp with time zone")
.HasColumnOrder(3);
b.Property("Type")
.HasColumnType("integer")
.HasColumnOrder(5);
b.Property("Value_Binary")
.HasColumnType("bytea");
b.Property("Value_Boolean")
.HasColumnType("boolean");
b.Property("Value_DateTime")
.HasColumnType("timestamp with time zone");
b.Property("Value_Double")
.HasColumnType("double precision");
b.Property("Value_Json")
.HasColumnType("jsonb");
b.Property("Value_Long")
.HasColumnType("bigint");
b.Property("Value_String")
.HasColumnType("text");
b.Property("Value_XML")
.HasColumnType("xml");
b.HasKey("Catalog", "DeviceId", "KeyName");
b.HasIndex("Catalog");
b.HasIndex("Catalog", "DeviceId");
b.ToTable("DataStorage");
b.HasDiscriminator("Catalog").HasValue(0);
});
modelBuilder.Entity("IoTSharp.Data.Device", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AuthorizedKeyId")
.HasColumnType("uuid");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("DeviceModelId")
.HasColumnType("uuid");
b.Property("DeviceType")
.HasColumnType("integer");
b.Property("LastActive")
.HasColumnType("timestamp with time zone");
b.Property("Name")
.HasColumnType("text");
b.Property("Online")
.HasColumnType("boolean");
b.Property("OwnerId")
.HasColumnType("uuid");
b.Property("Status")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("Timeout")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AuthorizedKeyId");
b.HasIndex("CustomerId");
b.HasIndex("DeviceModelId");
b.HasIndex("OwnerId");
b.HasIndex("TenantId");
b.ToTable("Device");
b.HasDiscriminator("DeviceType").HasValue(0);
});
modelBuilder.Entity("IoTSharp.Data.DeviceDiagram", b =>
{
b.Property("DiagramId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreateDate")
.HasColumnType("timestamp with time zone");
b.Property("Creator")
.HasColumnType("uuid");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("DiagramDesc")
.HasColumnType("text");
b.Property("DiagramImage")
.HasColumnType("text");
b.Property("DiagramName")
.HasColumnType("text");
b.Property("DiagramStatus")
.HasColumnType("integer");
b.Property("IsDefault")
.HasColumnType("boolean");
b.Property("TenantId")
.HasColumnType("uuid");
b.HasKey("DiagramId");
b.HasIndex("CustomerId");
b.HasIndex("TenantId");
b.ToTable("DeviceDiagrams");
});
modelBuilder.Entity("IoTSharp.Data.DeviceGraph", b =>
{
b.Property("GraphId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreateDate")
.HasColumnType("timestamp with time zone");
b.Property("Creator")
.HasColumnType("uuid");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("DeviceDiagramDiagramId")
.HasColumnType("uuid");
b.Property("DeviceId")
.HasColumnType("uuid");
b.Property("GraphElementId")
.HasColumnType("text");
b.Property("GraphFill")
.HasColumnType("text");
b.Property("GraphHeight")
.HasColumnType("integer");
b.Property("GraphPostionX")
.HasColumnType("integer");
b.Property("GraphPostionY")
.HasColumnType("integer");
b.Property("GraphShape")
.HasColumnType("text");
b.Property("GraphStroke")
.HasColumnType("text");
b.Property("GraphStrokeWidth")
.HasColumnType("integer");
b.Property("GraphTextAnchor")
.HasColumnType("text");
b.Property("GraphTextFill")
.HasColumnType("text");
b.Property("GraphTextFontFamily")
.HasColumnType("text");
b.Property("GraphTextFontSize")
.HasColumnType("integer");
b.Property("GraphTextRefX")
.HasColumnType("integer");
b.Property("GraphTextRefY")
.HasColumnType("integer");
b.Property("GraphTextVerticalAnchor")
.HasColumnType("text");
b.Property("GraphWidth")
.HasColumnType("integer");
b.Property("TenantId")
.HasColumnType("uuid");
b.HasKey("GraphId");
b.HasIndex("CustomerId");
b.HasIndex("DeviceDiagramDiagramId");
b.HasIndex("TenantId");
b.ToTable("DeviceGraphs");
});
modelBuilder.Entity("IoTSharp.Data.DeviceGraphToolBox", b =>
{
b.Property("ToolBoxId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CommondParam")
.HasColumnType("text");
b.Property("CommondType")
.HasColumnType("text");
b.Property("CreateDate")
.HasColumnType("timestamp with time zone");
b.Property("Creator")
.HasColumnType("uuid");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("DeviceId")
.HasColumnType("bigint");
b.Property("TenantId")
.HasColumnType("uuid");
b.Property("ToolBoxIcon")
.HasColumnType("text");
b.Property("ToolBoxName")
.HasColumnType("text");
b.Property("ToolBoxOffsetLeftPer")
.HasColumnType("integer");
b.Property("ToolBoxOffsetTopPer")
.HasColumnType("integer");
b.Property("ToolBoxOffsetX")
.HasColumnType("integer");
b.Property("ToolBoxOffsetY")
.HasColumnType("integer");
b.Property("ToolBoxRequestUri")
.HasColumnType("text");
b.Property("ToolBoxStatus")
.HasColumnType("integer");
b.Property("ToolBoxType")
.HasColumnType("text");
b.HasKey("ToolBoxId");
b.HasIndex("CustomerId");
b.HasIndex("TenantId");
b.ToTable("DeviceGraphToolBoxes");
});
modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("DeviceId")
.HasColumnType("uuid");
b.Property("IdentityId")
.IsRequired()
.HasColumnType("text");
b.Property("IdentityType")
.HasColumnType("integer");
b.Property("IdentityValue")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("DeviceId")
.IsUnique();
b.ToTable("DeviceIdentities");
});
modelBuilder.Entity("IoTSharp.Data.DeviceModel", b =>
{
b.Property("DeviceModelId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreateDateTime")
.HasColumnType("timestamp with time zone");
b.Property("Creator")
.HasColumnType("uuid");
b.Property("ModelDesc")
.HasColumnType("text");
b.Property("ModelName")
.HasColumnType("text");
b.Property("ModelStatus")
.HasColumnType("integer");
b.HasKey("DeviceModelId");
b.ToTable("DeviceModels");
});
modelBuilder.Entity("IoTSharp.Data.DeviceModelCommand", b =>
{
b.Property("CommandId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CommandI18N")
.HasColumnType("text");
b.Property("CommandName")
.HasColumnType("text");
b.Property("CommandParams")
.HasColumnType("text");
b.Property("CommandStatus")
.HasColumnType("integer");
b.Property("CommandTemplate")
.HasColumnType("text");
b.Property("CommandTitle")
.HasColumnType("text");
b.Property("CommandType")
.HasColumnType("integer");
b.Property("CreateDateTime")
.HasColumnType("timestamp with time zone");
b.Property("Creator")
.HasColumnType("uuid");
b.Property("DeviceModelId")
.HasColumnType("uuid");
b.HasKey("CommandId");
b.HasIndex("DeviceModelId");
b.ToTable("DeviceModelCommands");
});
modelBuilder.Entity("IoTSharp.Data.DevicePort", b =>
{
b.Property("PortId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreateDate")
.HasColumnType("timestamp with time zone");
b.Property("Creator")
.HasColumnType("bigint");
b.Property("DeviceId")
.HasColumnType("uuid");
b.Property("PortDesc")
.HasColumnType("text");
b.Property("PortElementId")
.HasColumnType("text");
b.Property("PortName")
.HasColumnType("text");
b.Property("PortPhyType")
.HasColumnType("integer");
b.Property("PortPic")
.HasColumnType("text");
b.Property("PortStatus")
.HasColumnType("integer");
b.Property("PortType")
.HasColumnType("integer");
b.HasKey("PortId");
b.ToTable("DevicePorts");
});
modelBuilder.Entity("IoTSharp.Data.DevicePortMapping", b =>
{
b.Property("MappingId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreateDate")
.HasColumnType("timestamp with time zone");
b.Property("Creator")
.HasColumnType("uuid");
b.Property("MappingIndex")
.HasColumnType("integer");
b.Property("MappingStatus")
.HasColumnType("integer");
b.Property("SourceDeviceId")
.HasColumnType("uuid");
b.Property("SourceElementId")
.HasColumnType("text");
b.Property("SourceId")
.HasColumnType("text");
b.Property("TargeId")
.HasColumnType("text");
b.Property("TargetDeviceId")
.HasColumnType("uuid");
b.Property("TargetElementId")
.HasColumnType("text");
b.HasKey("MappingId");
b.ToTable("DevicePortMappings");
});
modelBuilder.Entity("IoTSharp.Data.DeviceRule", b =>
{
b.Property("DeviceRuleId")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ConfigDateTime")
.HasColumnType("timestamp with time zone");
b.Property("ConfigUser")
.HasColumnType("uuid");
b.Property("DeviceId")
.HasColumnType("uuid");
b.Property("EnableTrace")
.HasColumnType("integer");
b.Property("FlowRuleRuleId")
.HasColumnType("uuid");
b.HasKey("DeviceRuleId");
b.HasIndex("DeviceId");
b.HasIndex("FlowRuleRuleId");
b.ToTable("DeviceRules");
});
modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b =>
{
b.Property("FieldId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("FieldId"));
b.Property("Creator")
.HasColumnType("uuid");
b.Property("CustomerId")
.HasColumnType("uuid");
b.Property("FieldCode")
.HasColumnType("text");
b.Property("FieldCreateDate")
.HasColumnType("timestamp with time zone");
b.Property("FieldEditDate")
.HasColumnType("timestamp with time zone");
b.Property("FieldI18nKey")
.HasColumnType("text");
b.Property("FieldMaxLength")
.HasColumnType("integer");
b.Property("FieldName")
.HasColumnType("text");
b.Property("FieldPattern")
.HasColumnType("text");
b.Property("FieldPocoTypeName")
.HasColumnType("text");
b.Property("FieldStatus")
.HasColumnType("integer");
b.Property("FieldUIElement")
.HasColumnType("bigint");
b.Property("FieldUIElementSchema")
.HasColumnType("text");
b.Property("FieldUnit")
.HasColumnType("text");
b.Property("FieldValue")
.HasColumnType("text");
b.Property("FieldValueDataSource")
.HasColumnType("text");
b.Property("FieldValueLocalDataSource")
.HasColumnType("text");
b.Property("FieldValueType")
.HasColumnType("integer");
b.Property("FieldValueTypeName")
.HasColumnType("text");
b.Property("FormId")
.HasColumnType("bigint");
b.Property("IsEnabled")
.HasColumnType("boolean");
b.Property