diff --git a/IoTSharp.Data.MySQL/Migrations/20220209182518_refreshtoken.Designer.cs b/IoTSharp.Data.MySQL/Migrations/20220209182518_refreshtoken.Designer.cs deleted file mode 100644 index c78e36038e1e0c55c0a37e961e3d6c675fed6e8e..0000000000000000000000000000000000000000 --- a/IoTSharp.Data.MySQL/Migrations/20220209182518_refreshtoken.Designer.cs +++ /dev/null @@ -1,2321 +0,0 @@ -// -using System; -using IoTSharp.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace IoTSharp.Data.MySql.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20220209182518_refreshtoken")] - partial class refreshtoken - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "6.0.1") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - modelBuilder.Entity("IoTSharp.Data.AuditLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ActionData") - .HasColumnType("JSON"); - - b.Property("ActionName") - .HasColumnType("longtext"); - - b.Property("ActionResult") - .HasColumnType("JSON"); - - b.Property("ActiveDateTime") - .HasColumnType("timestamp"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("ObjectID") - .HasColumnType("char(36)"); - - b.Property("ObjectName") - .HasColumnType("longtext"); - - b.Property("ObjectType") - .HasColumnType("int"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("UserId") - .HasColumnType("longtext"); - - b.Property("UserName") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("AuditLog"); - }); - - modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AuthToken") - .HasColumnType("longtext"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("AuthorizedKeys"); - }); - - modelBuilder.Entity("IoTSharp.Data.BaseDictionary", b => - { - b.Property("DictionaryId") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("Dictionary18NKeyName") - .HasColumnType("longtext"); - - b.Property("DictionaryColor") - .HasColumnType("longtext"); - - b.Property("DictionaryDesc") - .HasColumnType("longtext"); - - b.Property("DictionaryGroupId") - .HasColumnType("bigint"); - - b.Property("DictionaryIcon") - .HasColumnType("longtext"); - - b.Property("DictionaryName") - .HasColumnType("longtext"); - - b.Property("DictionaryPattern") - .HasColumnType("longtext"); - - b.Property("DictionaryStatus") - .HasColumnType("int"); - - b.Property("DictionaryTag") - .HasColumnType("longtext"); - - b.Property("DictionaryValue") - .HasColumnType("longtext"); - - b.Property("DictionaryValueType") - .HasColumnType("int"); - - b.Property("DictionaryValueTypeName") - .HasColumnType("longtext"); - - b.HasKey("DictionaryId"); - - b.ToTable("BaseDictionaries"); - }); - - modelBuilder.Entity("IoTSharp.Data.BaseDictionaryGroup", b => - { - b.Property("DictionaryGroupId") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("DictionaryGroup18NKeyName") - .HasColumnType("longtext"); - - b.Property("DictionaryGroupDesc") - .HasColumnType("longtext"); - - b.Property("DictionaryGroupKey") - .HasColumnType("longtext"); - - b.Property("DictionaryGroupName") - .HasColumnType("longtext"); - - b.Property("DictionaryGroupStatus") - .HasColumnType("int"); - - b.Property("DictionaryGroupValueType") - .HasColumnType("int"); - - b.Property("DictionaryGroupValueTypeName") - .HasColumnType("longtext"); - - b.HasKey("DictionaryGroupId"); - - b.ToTable("BaseDictionaryGroups"); - }); - - modelBuilder.Entity("IoTSharp.Data.BaseEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("BizData") - .HasColumnType("longtext"); - - b.Property("Bizid") - .HasColumnType("longtext"); - - b.Property("CreaterDateTime") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("EventDesc") - .HasColumnType("longtext"); - - b.Property("EventName") - .HasColumnType("longtext"); - - b.Property("EventStaus") - .HasColumnType("int"); - - b.Property("FlowRuleRuleId") - .HasColumnType("char(36)"); - - b.Property("MataData") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("int"); - - 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"); - - b.Property("AddDate") - .HasColumnType("datetime(6)"); - - b.Property("KeyName") - .HasColumnType("longtext"); - - b.Property("ResouceDesc") - .HasColumnType("longtext"); - - b.Property("ResouceGroupId") - .HasColumnType("int"); - - b.Property("ResourceId") - .HasColumnType("bigint"); - - b.Property("ResourceKey") - .HasColumnType("longtext"); - - b.Property("ResourceTag") - .HasColumnType("longtext"); - - b.Property("ResourceType") - .HasColumnType("int"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("UserId") - .HasColumnType("char(36)"); - - b.Property("ValueBG") - .HasColumnType("longtext"); - - b.Property("ValueCS") - .HasColumnType("longtext"); - - b.Property("ValueDA") - .HasColumnType("longtext"); - - b.Property("ValueDEDE") - .HasColumnType("longtext"); - - b.Property("ValueELGR") - .HasColumnType("longtext"); - - b.Property("ValueENGR") - .HasColumnType("longtext"); - - b.Property("ValueENUS") - .HasColumnType("longtext"); - - b.Property("ValueESES") - .HasColumnType("longtext"); - - b.Property("ValueFI") - .HasColumnType("longtext"); - - b.Property("ValueFRFR") - .HasColumnType("longtext"); - - b.Property("ValueHE") - .HasColumnType("longtext"); - - b.Property("ValueHRHR") - .HasColumnType("longtext"); - - b.Property("ValueHU") - .HasColumnType("longtext"); - - b.Property("ValueITIT") - .HasColumnType("longtext"); - - b.Property("ValueJAJP") - .HasColumnType("longtext"); - - b.Property("ValueKOKR") - .HasColumnType("longtext"); - - b.Property("ValueNL") - .HasColumnType("longtext"); - - b.Property("ValuePLPL") - .HasColumnType("longtext"); - - b.Property("ValuePT") - .HasColumnType("longtext"); - - b.Property("ValueSLSL") - .HasColumnType("longtext"); - - b.Property("ValueSR") - .HasColumnType("longtext"); - - b.Property("ValueSV") - .HasColumnType("longtext"); - - b.Property("ValueTRTR") - .HasColumnType("longtext"); - - b.Property("ValueUK") - .HasColumnType("longtext"); - - b.Property("ValueVI") - .HasColumnType("longtext"); - - b.Property("ValueZHCN") - .HasColumnType("longtext"); - - b.Property("ValueZHTW") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.ToTable("BaseI18Ns"); - }); - - modelBuilder.Entity("IoTSharp.Data.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("City") - .HasColumnType("longtext"); - - b.Property("Country") - .HasColumnType("longtext"); - - b.Property("Email") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("Phone") - .HasColumnType("longtext"); - - b.Property("Province") - .HasColumnType("longtext"); - - b.Property("Street") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ZipCode") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("TenantId"); - - b.ToTable("Customer"); - }); - - modelBuilder.Entity("IoTSharp.Data.DataStorage", b => - { - b.Property("Catalog") - .HasColumnType("int") - .HasColumnOrder(0); - - b.Property("DeviceId") - .HasColumnType("char(36)") - .HasColumnOrder(1); - - b.Property("KeyName") - .HasColumnType("varchar(255)") - .HasColumnOrder(2); - - b.Property("DataSide") - .HasColumnType("int") - .HasColumnOrder(4); - - b.Property("DateTime") - .HasColumnType("timestamp") - .HasColumnOrder(3); - - b.Property("Type") - .HasColumnType("int") - .HasColumnOrder(5); - - b.Property("Value_Binary") - .HasColumnType("longblob"); - - b.Property("Value_Boolean") - .HasColumnType("tinyint(1)"); - - b.Property("Value_DateTime") - .HasColumnType("timestamp"); - - b.Property("Value_Double") - .HasColumnType("double"); - - b.Property("Value_Json") - .HasColumnType("JSON"); - - b.Property("Value_Long") - .HasColumnType("bigint"); - - b.Property("Value_String") - .HasColumnType("longtext"); - - b.Property("Value_XML") - .HasColumnType("longtext"); - - 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("char(36)"); - - b.Property("AuthorizedKeyId") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("DeviceModelId") - .HasColumnType("char(36)"); - - b.Property("DeviceType") - .HasColumnType("int"); - - b.Property("LastActive") - .HasColumnType("timestamp"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("Online") - .HasColumnType("tinyint(1)"); - - b.Property("OwnerId") - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("Timeout") - .HasColumnType("int"); - - 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("char(36)"); - - b.Property("CreateDate") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("DiagramDesc") - .HasColumnType("longtext"); - - b.Property("DiagramImage") - .HasColumnType("longtext"); - - b.Property("DiagramName") - .HasColumnType("longtext"); - - b.Property("DiagramStatus") - .HasColumnType("int"); - - b.Property("IsDefault") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("DiagramId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("DeviceDiagrams"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceGraph", b => - { - b.Property("GraphId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreateDate") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("DeviceDiagramDiagramId") - .HasColumnType("char(36)"); - - b.Property("DeviceId") - .HasColumnType("char(36)"); - - b.Property("GraphElementId") - .HasColumnType("longtext"); - - b.Property("GraphFill") - .HasColumnType("longtext"); - - b.Property("GraphHeight") - .HasColumnType("decimal(65,30)"); - - b.Property("GraphPostionX") - .HasColumnType("decimal(65,30)"); - - b.Property("GraphPostionY") - .HasColumnType("decimal(65,30)"); - - b.Property("GraphShape") - .HasColumnType("longtext"); - - b.Property("GraphStroke") - .HasColumnType("longtext"); - - b.Property("GraphStrokeWidth") - .HasColumnType("decimal(65,30)"); - - b.Property("GraphTextAnchor") - .HasColumnType("longtext"); - - b.Property("GraphTextFill") - .HasColumnType("longtext"); - - b.Property("GraphTextFontFamily") - .HasColumnType("longtext"); - - b.Property("GraphTextFontSize") - .HasColumnType("decimal(65,30)"); - - b.Property("GraphTextRefX") - .HasColumnType("decimal(65,30)"); - - b.Property("GraphTextRefY") - .HasColumnType("decimal(65,30)"); - - b.Property("GraphTextVerticalAnchor") - .HasColumnType("longtext"); - - b.Property("GraphWidth") - .HasColumnType("decimal(65,30)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - 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("char(36)"); - - b.Property("CommondParam") - .HasColumnType("longtext"); - - b.Property("CommondType") - .HasColumnType("longtext"); - - b.Property("CreateDate") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("DeviceId") - .HasColumnType("bigint"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("ToolBoxIcon") - .HasColumnType("longtext"); - - b.Property("ToolBoxName") - .HasColumnType("longtext"); - - b.Property("ToolBoxOffsetLeftPer") - .HasColumnType("decimal(65,30)"); - - b.Property("ToolBoxOffsetTopPer") - .HasColumnType("decimal(65,30)"); - - b.Property("ToolBoxOffsetX") - .HasColumnType("decimal(65,30)"); - - b.Property("ToolBoxOffsetY") - .HasColumnType("decimal(65,30)"); - - b.Property("ToolBoxRequestUri") - .HasColumnType("longtext"); - - b.Property("ToolBoxStatus") - .HasColumnType("int"); - - b.Property("ToolBoxType") - .HasColumnType("longtext"); - - b.HasKey("ToolBoxId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("DeviceGraphToolBoxes"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("DeviceId") - .HasColumnType("char(36)"); - - b.Property("IdentityId") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("IdentityType") - .HasColumnType("int"); - - b.Property("IdentityValue") - .HasColumnType("longtext"); - - b.HasKey("Id"); - - b.HasIndex("DeviceId") - .IsUnique(); - - b.ToTable("DeviceIdentities"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceModel", b => - { - b.Property("DeviceModelId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreateDateTime") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("ModelDesc") - .HasColumnType("longtext"); - - b.Property("ModelName") - .HasColumnType("longtext"); - - b.Property("ModelStatus") - .HasColumnType("int"); - - b.HasKey("DeviceModelId"); - - b.ToTable("DeviceModels"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceModelCommand", b => - { - b.Property("CommandId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CommandI18N") - .HasColumnType("longtext"); - - b.Property("CommandName") - .HasColumnType("longtext"); - - b.Property("CommandParams") - .HasColumnType("longtext"); - - b.Property("CommandStatus") - .HasColumnType("int"); - - b.Property("CommandTemplate") - .HasColumnType("longtext"); - - b.Property("CommandTitle") - .HasColumnType("longtext"); - - b.Property("CommandType") - .HasColumnType("int"); - - b.Property("CreateDateTime") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("DeviceModelId") - .HasColumnType("char(36)"); - - b.HasKey("CommandId"); - - b.HasIndex("DeviceModelId"); - - b.ToTable("DeviceModelCommands"); - }); - - modelBuilder.Entity("IoTSharp.Data.DevicePort", b => - { - b.Property("PortId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreateDate") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("bigint"); - - b.Property("DeviceId") - .HasColumnType("char(36)"); - - b.Property("PortDesc") - .HasColumnType("longtext"); - - b.Property("PortElementId") - .HasColumnType("longtext"); - - b.Property("PortName") - .HasColumnType("longtext"); - - b.Property("PortPhyType") - .HasColumnType("int"); - - b.Property("PortPic") - .HasColumnType("longtext"); - - b.Property("PortStatus") - .HasColumnType("int"); - - b.Property("PortType") - .HasColumnType("int"); - - b.HasKey("PortId"); - - b.ToTable("DevicePorts"); - }); - - modelBuilder.Entity("IoTSharp.Data.DevicePortMapping", b => - { - b.Property("MappingId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreateDate") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("MappingIndex") - .HasColumnType("decimal(65,30)"); - - b.Property("MappingStatus") - .HasColumnType("int"); - - b.Property("SourceDeviceId") - .HasColumnType("char(36)"); - - b.Property("SourceElementId") - .HasColumnType("longtext"); - - b.Property("SourceId") - .HasColumnType("longtext"); - - b.Property("TargeId") - .HasColumnType("longtext"); - - b.Property("TargetDeviceId") - .HasColumnType("char(36)"); - - b.Property("TargetElementId") - .HasColumnType("longtext"); - - b.HasKey("MappingId"); - - b.ToTable("DevicePortMappings"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceRule", b => - { - b.Property("DeviceRuleId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("ConfigDateTime") - .HasColumnType("datetime(6)"); - - b.Property("ConfigUser") - .HasColumnType("char(36)"); - - b.Property("DeviceId") - .HasColumnType("char(36)"); - - b.Property("EnableTrace") - .HasColumnType("int"); - - b.Property("FlowRuleRuleId") - .HasColumnType("char(36)"); - - b.HasKey("DeviceRuleId"); - - b.HasIndex("DeviceId"); - - b.HasIndex("FlowRuleRuleId"); - - b.ToTable("DeviceRules"); - }); - - modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b => - { - b.Property("FieldId") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("FieldCode") - .HasColumnType("longtext"); - - b.Property("FieldCreateDate") - .HasColumnType("datetime(6)"); - - b.Property("FieldEditDate") - .HasColumnType("datetime(6)"); - - b.Property("FieldI18nKey") - .HasColumnType("longtext"); - - b.Property("FieldMaxLength") - .HasColumnType("int"); - - b.Property("FieldName") - .HasColumnType("longtext"); - - b.Property("FieldPattern") - .HasColumnType("longtext"); - - b.Property("FieldPocoTypeName") - .HasColumnType("longtext"); - - b.Property("FieldStatus") - .HasColumnType("int"); - - b.Property("FieldUIElement") - .HasColumnType("bigint"); - - b.Property("FieldUIElementSchema") - .HasColumnType("longtext"); - - b.Property("FieldUnit") - .HasColumnType("longtext"); - - b.Property("FieldValue") - .HasColumnType("longtext"); - - b.Property("FieldValueDataSource") - .HasColumnType("longtext"); - - b.Property("FieldValueLocalDataSource") - .HasColumnType("longtext"); - - b.Property("FieldValueType") - .HasColumnType("int"); - - b.Property("FieldValueTypeName") - .HasColumnType("longtext"); - - b.Property("FormId") - .HasColumnType("bigint"); - - b.Property("IsEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("IsRequired") - .HasColumnType("tinyint(1)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("FieldId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("DynamicFormFieldInfos"); - }); - - modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldValueInfo", b => - { - b.Property("FieldValueId") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("BizId") - .HasColumnType("bigint"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("FieldCode") - .HasColumnType("longtext"); - - b.Property("FieldCreateDate") - .HasColumnType("datetime(6)"); - - b.Property("FieldId") - .HasColumnType("bigint"); - - b.Property("FieldName") - .HasColumnType("longtext"); - - b.Property("FieldUnit") - .HasColumnType("longtext"); - - b.Property("FieldValue") - .HasColumnType("longtext"); - - b.Property("FieldValueType") - .HasColumnType("bigint"); - - b.Property("FromId") - .HasColumnType("bigint"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("FieldValueId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("DynamicFormFieldValueInfos"); - }); - - modelBuilder.Entity("IoTSharp.Data.DynamicFormInfo", b => - { - b.Property("FormId") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - b.Property("BizId") - .HasColumnType("bigint"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("FormCreator") - .HasColumnType("bigint"); - - b.Property("FormDesc") - .HasColumnType("longtext"); - - b.Property("FormLayout") - .HasColumnType("longtext"); - - b.Property("FormName") - .HasColumnType("longtext"); - - b.Property("FormSchame") - .HasColumnType("longtext"); - - b.Property("FormStatus") - .HasColumnType("int"); - - b.Property("FromCreateDate") - .HasColumnType("datetime(6)"); - - b.Property("IsCompact") - .HasColumnType("tinyint(1)"); - - b.Property("ModelClass") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("Url") - .HasColumnType("longtext"); - - b.HasKey("FormId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("DynamicFormInfos"); - }); - - modelBuilder.Entity("IoTSharp.Data.Flow", b => - { - b.Property("FlowId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Conditionexpression") - .HasColumnType("longtext"); - - b.Property("CreateDate") - .HasColumnType("datetime(6)"); - - b.Property("CreateId") - .HasColumnType("char(36)"); - - b.Property("Createor") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("ExecutorId") - .HasColumnType("char(36)"); - - b.Property("FlowRuleRuleId") - .HasColumnType("char(36)"); - - b.Property("FlowStatus") - .HasColumnType("int"); - - b.Property("FlowType") - .HasColumnType("longtext"); - - b.Property("Flowdesc") - .HasColumnType("longtext"); - - b.Property("Flowname") - .HasColumnType("longtext"); - - b.Property("Incoming") - .HasColumnType("longtext"); - - b.Property("NodeProcessClass") - .HasColumnType("longtext"); - - b.Property("NodeProcessMethod") - .HasColumnType("longtext"); - - b.Property("NodeProcessParams") - .HasColumnType("longtext"); - - b.Property("NodeProcessScript") - .HasColumnType("longtext"); - - b.Property("NodeProcessScriptType") - .HasColumnType("longtext"); - - b.Property("NodeProcessType") - .HasColumnType("longtext"); - - b.Property("ObjectId") - .HasColumnType("longtext"); - - b.Property("Outgoing") - .HasColumnType("longtext"); - - b.Property("SourceId") - .HasColumnType("longtext"); - - b.Property("TargetId") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TestStatus") - .HasColumnType("int"); - - b.Property("Tester") - .HasColumnType("char(36)"); - - b.Property("TesterDateTime") - .HasColumnType("datetime(6)"); - - b.Property("bpmnid") - .HasColumnType("longtext"); - - b.HasKey("FlowId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("ExecutorId"); - - b.HasIndex("FlowRuleRuleId"); - - b.HasIndex("TenantId"); - - b.ToTable("Flows"); - }); - - modelBuilder.Entity("IoTSharp.Data.FlowOperation", b => - { - b.Property("OperationId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AddDate") - .HasColumnType("datetime(6)"); - - b.Property("BaseEventId") - .HasColumnType("char(36)"); - - b.Property("BizId") - .HasColumnType("longtext"); - - b.Property("Data") - .HasColumnType("longtext"); - - b.Property("FlowId") - .HasColumnType("char(36)"); - - b.Property("FlowRuleId") - .HasColumnType("char(36)"); - - b.Property("NodeStatus") - .HasColumnType("int"); - - b.Property("OperationDesc") - .HasColumnType("longtext"); - - b.Property("Step") - .HasColumnType("int"); - - b.Property("Tag") - .HasColumnType("longtext"); - - b.Property("bpmnid") - .HasColumnType("longtext"); - - b.HasKey("OperationId"); - - b.HasIndex("BaseEventId"); - - b.HasIndex("FlowId"); - - b.HasIndex("FlowRuleId"); - - b.ToTable("FlowOperations"); - }); - - modelBuilder.Entity("IoTSharp.Data.FlowRule", b => - { - b.Property("RuleId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreatTime") - .HasColumnType("datetime(6)"); - - b.Property("CreateId") - .HasColumnType("char(36)"); - - b.Property("Creator") - .HasColumnType("longtext"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("DefinitionsXml") - .HasColumnType("longtext"); - - b.Property("Describes") - .HasColumnType("longtext"); - - b.Property("ExecutableCode") - .HasColumnType("longtext"); - - b.Property("MountType") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ParentRuleId") - .HasColumnType("char(36)"); - - b.Property("RuleDesc") - .HasColumnType("longtext"); - - b.Property("RuleStatus") - .HasColumnType("int"); - - b.Property("RuleType") - .HasColumnType("int"); - - b.Property("Runner") - .HasColumnType("longtext"); - - b.Property("SubVersion") - .HasColumnType("double"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("Version") - .HasColumnType("double"); - - b.HasKey("RuleId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("FlowRules"); - }); - - modelBuilder.Entity("IoTSharp.Data.RefreshToken", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AddedDate") - .HasColumnType("datetime(6)"); - - b.Property("ExpiryDate") - .HasColumnType("datetime(6)"); - - b.Property("IsRevorked") - .HasColumnType("tinyint(1)"); - - b.Property("IsUsed") - .HasColumnType("tinyint(1)"); - - b.Property("JwtId") - .HasColumnType("longtext"); - - b.Property("Token") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RefreshTokens"); - }); - - modelBuilder.Entity("IoTSharp.Data.Relationship", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("IdentityUserId") - .HasColumnType("varchar(255)"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.HasIndex("IdentityUserId"); - - b.HasIndex("TenantId"); - - b.ToTable("Relationship"); - }); - - modelBuilder.Entity("IoTSharp.Data.RuleTaskExecutor", b => - { - b.Property("ExecutorId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("AddDateTime") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("DefaultConfig") - .HasColumnType("longtext"); - - b.Property("ExecutorDesc") - .HasColumnType("longtext"); - - b.Property("ExecutorName") - .HasColumnType("longtext"); - - b.Property("ExecutorStatus") - .HasColumnType("int"); - - b.Property("MataData") - .HasColumnType("longtext"); - - b.Property("Path") - .HasColumnType("longtext"); - - b.Property("Tag") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("TestStatus") - .HasColumnType("int"); - - b.Property("Tester") - .HasColumnType("char(36)"); - - b.Property("TesterDateTime") - .HasColumnType("datetime(6)"); - - b.Property("TypeName") - .HasColumnType("longtext"); - - b.HasKey("ExecutorId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("RuleTaskExecutors"); - }); - - modelBuilder.Entity("IoTSharp.Data.SubscriptionEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("CreateDateTime") - .HasColumnType("datetime(6)"); - - b.Property("Creator") - .HasColumnType("char(36)"); - - b.Property("CustomerId") - .HasColumnType("char(36)"); - - b.Property("EventDesc") - .HasColumnType("longtext"); - - b.Property("EventName") - .HasColumnType("longtext"); - - b.Property("EventNameSpace") - .HasColumnType("longtext"); - - b.Property("EventParam") - .HasColumnType("longtext"); - - b.Property("EventStatus") - .HasColumnType("int"); - - b.Property("EventTag") - .HasColumnType("longtext"); - - b.Property("TenantId") - .HasColumnType("char(36)"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("EventId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("TenantId"); - - b.ToTable("SubscriptionEvents"); - }); - - modelBuilder.Entity("IoTSharp.Data.SubscriptionTask", b => - { - b.Property("BindId") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("EventId") - .HasColumnType("char(36)"); - - b.Property("RuleTaskExecutorExecutorId") - .HasColumnType("char(36)"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("SubscriptionEventId") - .HasColumnType("char(36)"); - - b.Property("TaskConfig") - .HasColumnType("longtext"); - - b.HasKey("BindId"); - - b.HasIndex("RuleTaskExecutorExecutorId"); - - b.HasIndex("SubscriptionEventId"); - - b.ToTable("SubscriptionTasks"); - }); - - modelBuilder.Entity("IoTSharp.Data.TelemetryData", b => - { - b.Property("DeviceId") - .HasColumnType("char(36)") - .HasColumnOrder(1); - - b.Property("KeyName") - .HasColumnType("varchar(255)") - .HasColumnOrder(2); - - b.Property("DateTime") - .HasColumnType("timestamp") - .HasColumnOrder(3); - - b.Property("DataSide") - .HasColumnType("int") - .HasColumnOrder(4); - - b.Property("Type") - .HasColumnType("int") - .HasColumnOrder(5); - - b.Property("Value_Binary") - .HasColumnType("longblob"); - - b.Property("Value_Boolean") - .HasColumnType("tinyint(1)"); - - b.Property("Value_DateTime") - .HasColumnType("timestamp"); - - b.Property("Value_Double") - .HasColumnType("double"); - - b.Property("Value_Json") - .HasColumnType("JSON"); - - b.Property("Value_Long") - .HasColumnType("bigint"); - - b.Property("Value_String") - .HasColumnType("longtext"); - - b.Property("Value_XML") - .HasColumnType("longtext"); - - b.HasKey("DeviceId", "KeyName", "DateTime"); - - b.HasIndex("DeviceId"); - - b.HasIndex("KeyName"); - - b.HasIndex("DeviceId", "KeyName"); - - b.ToTable("TelemetryData"); - }); - - modelBuilder.Entity("IoTSharp.Data.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("char(36)"); - - b.Property("Address") - .HasColumnType("longtext"); - - b.Property("City") - .HasColumnType("longtext"); - - b.Property("Country") - .HasColumnType("longtext"); - - b.Property("EMail") - .HasColumnType("longtext"); - - b.Property("Name") - .HasColumnType("longtext"); - - b.Property("Phone") - .HasColumnType("longtext"); - - b.Property("Province") - .HasColumnType("longtext"); - - b.Property("Street") - .HasColumnType("longtext"); - - b.Property("ZipCode") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("Tenant"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("varchar(255)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("varchar(255)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("RoleId") - .HasColumnType("varchar(255)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("varchar(255)"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("IoTSharp.Data.AttributeLatest", b => - { - b.HasBaseType("IoTSharp.Data.DataStorage"); - - b.HasDiscriminator().HasValue(2); - }); - - modelBuilder.Entity("IoTSharp.Data.Gateway", b => - { - b.HasBaseType("IoTSharp.Data.Device"); - - b.HasDiscriminator().HasValue(1); - }); - - modelBuilder.Entity("IoTSharp.Data.TelemetryLatest", b => - { - b.HasBaseType("IoTSharp.Data.DataStorage"); - - b.HasDiscriminator().HasValue(4); - }); - - modelBuilder.Entity("IoTSharp.Data.AuditLog", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId"); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId"); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.BaseEvent", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.FlowRule", "FlowRule") - .WithMany() - .HasForeignKey("FlowRuleRuleId"); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("FlowRule"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.Customer", b => - { - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany("Customers") - .HasForeignKey("TenantId"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.Device", b => - { - b.HasOne("IoTSharp.Data.AuthorizedKey", null) - .WithMany("Devices") - .HasForeignKey("AuthorizedKeyId"); - - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany("Devices") - .HasForeignKey("CustomerId"); - - b.HasOne("IoTSharp.Data.DeviceModel", "DeviceModel") - .WithMany() - .HasForeignKey("DeviceModelId"); - - b.HasOne("IoTSharp.Data.Gateway", "Owner") - .WithMany("Children") - .HasForeignKey("OwnerId"); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany("Devices") - .HasForeignKey("TenantId"); - - b.Navigation("Customer"); - - b.Navigation("DeviceModel"); - - b.Navigation("Owner"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceDiagram", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceGraph", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.DeviceDiagram", "DeviceDiagram") - .WithMany() - .HasForeignKey("DeviceDiagramDiagramId"); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("DeviceDiagram"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceGraphToolBox", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => - { - b.HasOne("IoTSharp.Data.Device", "Device") - .WithOne("DeviceIdentity") - .HasForeignKey("IoTSharp.Data.DeviceIdentity", "DeviceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Device"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceModelCommand", b => - { - b.HasOne("IoTSharp.Data.DeviceModel", "DeviceModel") - .WithMany("DeviceModelCommands") - .HasForeignKey("DeviceModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("DeviceModel"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceRule", b => - { - b.HasOne("IoTSharp.Data.Device", "Device") - .WithMany() - .HasForeignKey("DeviceId"); - - b.HasOne("IoTSharp.Data.FlowRule", "FlowRule") - .WithMany() - .HasForeignKey("FlowRuleRuleId"); - - b.Navigation("Device"); - - b.Navigation("FlowRule"); - }); - - modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldValueInfo", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.DynamicFormInfo", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.Flow", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.RuleTaskExecutor", "Executor") - .WithMany() - .HasForeignKey("ExecutorId"); - - b.HasOne("IoTSharp.Data.FlowRule", "FlowRule") - .WithMany() - .HasForeignKey("FlowRuleRuleId"); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("Executor"); - - b.Navigation("FlowRule"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.FlowOperation", b => - { - b.HasOne("IoTSharp.Data.BaseEvent", "BaseEvent") - .WithMany() - .HasForeignKey("BaseEventId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.Flow", "Flow") - .WithMany() - .HasForeignKey("FlowId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.FlowRule", "FlowRule") - .WithMany() - .HasForeignKey("FlowRuleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("BaseEvent"); - - b.Navigation("Flow"); - - b.Navigation("FlowRule"); - }); - - modelBuilder.Entity("IoTSharp.Data.FlowRule", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.RefreshToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") - .WithMany() - .HasForeignKey("UserId"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("IoTSharp.Data.Relationship", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId"); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "IdentityUser") - .WithMany() - .HasForeignKey("IdentityUserId"); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId"); - - b.Navigation("Customer"); - - b.Navigation("IdentityUser"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.RuleTaskExecutor", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.SubscriptionEvent", b => - { - b.HasOne("IoTSharp.Data.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("IoTSharp.Data.Tenant", "Tenant") - .WithMany() - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("Tenant"); - }); - - modelBuilder.Entity("IoTSharp.Data.SubscriptionTask", b => - { - b.HasOne("IoTSharp.Data.RuleTaskExecutor", "RuleTaskExecutor") - .WithMany() - .HasForeignKey("RuleTaskExecutorExecutorId"); - - b.HasOne("IoTSharp.Data.SubscriptionEvent", "Subscription") - .WithMany() - .HasForeignKey("SubscriptionEventId"); - - b.Navigation("RuleTaskExecutor"); - - b.Navigation("Subscription"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => - { - b.Navigation("Devices"); - }); - - modelBuilder.Entity("IoTSharp.Data.Customer", b => - { - b.Navigation("Devices"); - }); - - modelBuilder.Entity("IoTSharp.Data.Device", b => - { - b.Navigation("DeviceIdentity"); - }); - - modelBuilder.Entity("IoTSharp.Data.DeviceModel", b => - { - b.Navigation("DeviceModelCommands"); - }); - - modelBuilder.Entity("IoTSharp.Data.Tenant", b => - { - b.Navigation("Customers"); - - b.Navigation("Devices"); - }); - - modelBuilder.Entity("IoTSharp.Data.Gateway", b => - { - b.Navigation("Children"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/IoTSharp.Data.MySQL/Migrations/20220209182518_refreshtoken.cs b/IoTSharp.Data.MySQL/Migrations/20220209182518_refreshtoken.cs deleted file mode 100644 index b4215f91888148e954e648f27e33d3cd5a9494ea..0000000000000000000000000000000000000000 --- a/IoTSharp.Data.MySQL/Migrations/20220209182518_refreshtoken.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace IoTSharp.Data.MySql.Migrations -{ - public partial class refreshtoken : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "RefreshTokens", - columns: table => new - { - Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - UserId = table.Column(type: "varchar(255)", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - Token = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - JwtId = table.Column(type: "longtext", nullable: true) - .Annotation("MySql:CharSet", "utf8mb4"), - IsUsed = table.Column(type: "tinyint(1)", nullable: false), - IsRevorked = table.Column(type: "tinyint(1)", nullable: false), - AddedDate = table.Column(type: "datetime(6)", nullable: false), - ExpiryDate = table.Column(type: "datetime(6)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_RefreshTokens", x => x.Id); - table.ForeignKey( - name: "FK_RefreshTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id"); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateIndex( - name: "IX_RefreshTokens_UserId", - table: "RefreshTokens", - column: "UserId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "RefreshTokens"); - } - } -} diff --git a/IoTSharp.Data.MySQL/Migrations/20220212100754_FixTenantInfo.cs b/IoTSharp.Data.MySQL/Migrations/20220212100754_FixTenantInfo.cs index 957106e266379eee2d2534db998411785a35e8c4..9b8527ca0fdbe14ab721d0fdbefa8dc06a0a34a8 100644 --- a/IoTSharp.Data.MySQL/Migrations/20220212100754_FixTenantInfo.cs +++ b/IoTSharp.Data.MySQL/Migrations/20220212100754_FixTenantInfo.cs @@ -9,15 +9,53 @@ namespace IoTSharp.Data.MySql.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - + migrationBuilder.DropForeignKey( + name: "FK_DeviceIdentities_Device_DeviceId", + table: "DeviceIdentities"); + migrationBuilder.DropForeignKey( + name: "FK_FlowOperations_BaseEvents_BaseEventId", + table: "FlowOperations"); - + migrationBuilder.DropForeignKey( + name: "FK_FlowOperations_FlowRules_FlowRuleId", + table: "FlowOperations"); + + migrationBuilder.DropForeignKey( + name: "FK_FlowOperations_Flows_FlowId", + table: "FlowOperations"); - + migrationBuilder.DropForeignKey( + name: "FK_SubscriptionTasks_Customer_CustomerId", + table: "SubscriptionTasks"); - + migrationBuilder.DropIndex( + name: "IX_SubscriptionTasks_CustomerId", + table: "SubscriptionTasks"); + migrationBuilder.DropIndex( + name: "IX_FlowOperations_BaseEventId", + table: "FlowOperations"); + + migrationBuilder.DropIndex( + name: "IX_FlowOperations_FlowRuleId", + table: "FlowOperations"); + + migrationBuilder.DropIndex( + name: "IX_DeviceIdentities_DeviceId", + table: "DeviceIdentities"); + + migrationBuilder.DropColumn( + name: "CustomerId", + table: "SubscriptionTasks"); + + migrationBuilder.DropColumn( + name: "BaseEventId", + table: "FlowOperations"); + + migrationBuilder.DropColumn( + name: "FlowRuleId", + table: "FlowOperations"); migrationBuilder.AlterColumn( name: "Type", @@ -68,16 +106,68 @@ namespace IoTSharp.Data.MySql.Migrations .Annotation("Relational:ColumnOrder", 1) .OldAnnotation("Relational:Collation", "ascii_general_ci"); - + migrationBuilder.AddColumn( + name: "CustomerId", + table: "SubscriptionEvents", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "SubscriptionEvents", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + migrationBuilder.AddColumn( + name: "CustomerId", + table: "RuleTaskExecutors", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); - + migrationBuilder.AddColumn( + name: "TenantId", + table: "RuleTaskExecutors", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); - + migrationBuilder.AddColumn( + name: "CustomerId", + table: "Flows", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + migrationBuilder.AddColumn( + name: "TenantId", + table: "Flows", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.AddColumn( + name: "CustomerId", + table: "FlowRules", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "FlowRules", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); - - + migrationBuilder.AddColumn( + name: "Version", + table: "FlowRules", + type: "double", + nullable: false, + defaultValue: 0.0); migrationBuilder.AlterColumn( name: "NodeStatus", @@ -99,8 +189,19 @@ namespace IoTSharp.Data.MySql.Migrations oldType: "char(36)") .OldAnnotation("Relational:Collation", "ascii_general_ci"); - + migrationBuilder.AddColumn( + name: "BaseEventEventId", + table: "FlowOperations", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + migrationBuilder.AddColumn( + name: "FlowRuleRuleId", + table: "FlowOperations", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); migrationBuilder.AlterColumn( name: "FormStatus", @@ -132,8 +233,19 @@ namespace IoTSharp.Data.MySql.Migrations oldType: "bigint", oldNullable: true); - + migrationBuilder.AddColumn( + name: "CustomerId", + table: "DynamicFormInfos", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + migrationBuilder.AddColumn( + name: "TenantId", + table: "DynamicFormInfos", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); migrationBuilder.AlterColumn( name: "FromId", @@ -175,8 +287,19 @@ namespace IoTSharp.Data.MySql.Migrations oldType: "bigint", oldNullable: true); + migrationBuilder.AddColumn( + name: "CustomerId", + table: "DynamicFormFieldValueInfos", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); - + migrationBuilder.AddColumn( + name: "TenantId", + table: "DynamicFormFieldValueInfos", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); migrationBuilder.AlterColumn( name: "IsRequired", @@ -248,8 +371,19 @@ namespace IoTSharp.Data.MySql.Migrations oldType: "int", oldNullable: true); - + migrationBuilder.AddColumn( + name: "CustomerId", + table: "DynamicFormFieldInfos", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + migrationBuilder.AddColumn( + name: "TenantId", + table: "DynamicFormFieldInfos", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); migrationBuilder.AlterColumn( name: "PortType", @@ -383,9 +517,20 @@ namespace IoTSharp.Data.MySql.Migrations oldType: "bigint", oldNullable: true); - + migrationBuilder.AddColumn( + name: "CustomerId", + table: "DeviceGraphToolBoxes", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "DeviceGraphToolBoxes", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); - migrationBuilder.AlterColumn( name: "GraphWidth", table: "DeviceGraphs", @@ -466,7 +611,19 @@ namespace IoTSharp.Data.MySql.Migrations oldType: "decimal(65,30)", oldNullable: true); - + migrationBuilder.AddColumn( + name: "CustomerId", + table: "DeviceGraphs", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "DeviceGraphs", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); migrationBuilder.AlterColumn( name: "IsDefault", @@ -488,7 +645,20 @@ namespace IoTSharp.Data.MySql.Migrations oldType: "int", oldNullable: true); - + migrationBuilder.AddColumn( + name: "CustomerId", + table: "DeviceDiagrams", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "DeviceDiagrams", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + migrationBuilder.AlterColumn( name: "Type", table: "DataStorage", @@ -547,30 +717,233 @@ namespace IoTSharp.Data.MySql.Migrations oldType: "int") .Annotation("Relational:ColumnOrder", 0); - - + migrationBuilder.AddColumn( + name: "CustomerId", + table: "BaseEvents", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "BaseEvents", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.CreateTable( + name: "RefreshTokens", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + UserId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Token = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + JwtId = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + IsUsed = table.Column(type: "tinyint(1)", nullable: false), + IsRevorked = table.Column(type: "tinyint(1)", nullable: false), + AddedDate = table.Column(type: "datetime(6)", nullable: false), + ExpiryDate = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RefreshTokens", x => x.Id); + table.ForeignKey( + name: "FK_RefreshTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id"); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_SubscriptionEvents_CustomerId", + table: "SubscriptionEvents", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_SubscriptionEvents_TenantId", + table: "SubscriptionEvents", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_RuleTaskExecutors_CustomerId", + table: "RuleTaskExecutors", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_RuleTaskExecutors_TenantId", + table: "RuleTaskExecutors", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Flows_CustomerId", + table: "Flows", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_Flows_TenantId", + table: "Flows", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_FlowRules_CustomerId", + table: "FlowRules", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_FlowRules_TenantId", + table: "FlowRules", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_FlowOperations_BaseEventEventId", + table: "FlowOperations", + column: "BaseEventEventId"); + + migrationBuilder.CreateIndex( + name: "IX_FlowOperations_FlowRuleRuleId", + table: "FlowOperations", + column: "FlowRuleRuleId"); + + migrationBuilder.CreateIndex( + name: "IX_DynamicFormInfos_CustomerId", + table: "DynamicFormInfos", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_DynamicFormInfos_TenantId", + table: "DynamicFormInfos", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DynamicFormFieldValueInfos_CustomerId", + table: "DynamicFormFieldValueInfos", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_DynamicFormFieldValueInfos_TenantId", + table: "DynamicFormFieldValueInfos", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DynamicFormFieldInfos_CustomerId", + table: "DynamicFormFieldInfos", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_DynamicFormFieldInfos_TenantId", + table: "DynamicFormFieldInfos", + column: "TenantId"); + migrationBuilder.CreateIndex( + name: "IX_DeviceIdentities_DeviceId", + table: "DeviceIdentities", + column: "DeviceId", + unique: true); - + migrationBuilder.CreateIndex( + name: "IX_DeviceGraphToolBoxes_CustomerId", + table: "DeviceGraphToolBoxes", + column: "CustomerId"); + migrationBuilder.CreateIndex( + name: "IX_DeviceGraphToolBoxes_TenantId", + table: "DeviceGraphToolBoxes", + column: "TenantId"); - + migrationBuilder.CreateIndex( + name: "IX_DeviceGraphs_CustomerId", + table: "DeviceGraphs", + column: "CustomerId"); - + migrationBuilder.CreateIndex( + name: "IX_DeviceGraphs_TenantId", + table: "DeviceGraphs", + column: "TenantId"); - + migrationBuilder.CreateIndex( + name: "IX_DeviceDiagrams_CustomerId", + table: "DeviceDiagrams", + column: "CustomerId"); + migrationBuilder.CreateIndex( + name: "IX_DeviceDiagrams_TenantId", + table: "DeviceDiagrams", + column: "TenantId"); + migrationBuilder.CreateIndex( + name: "IX_BaseEvents_CustomerId", + table: "BaseEvents", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_BaseEvents_TenantId", + table: "BaseEvents", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_RefreshTokens_UserId", + table: "RefreshTokens", + column: "UserId"); + + migrationBuilder.AddForeignKey( + name: "FK_BaseEvents_Customer_CustomerId", + table: "BaseEvents", + column: "CustomerId", + principalTable: "Customer", + principalColumn: "Id"); + migrationBuilder.AddForeignKey( + name: "FK_BaseEvents_Tenant_TenantId", + table: "BaseEvents", + column: "TenantId", + principalTable: "Tenant", + principalColumn: "Id"); - + migrationBuilder.AddForeignKey( + name: "FK_DeviceDiagrams_Customer_CustomerId", + table: "DeviceDiagrams", + column: "CustomerId", + principalTable: "Customer", + principalColumn: "Id"); - + migrationBuilder.AddForeignKey( + name: "FK_DeviceDiagrams_Tenant_TenantId", + table: "DeviceDiagrams", + column: "TenantId", + principalTable: "Tenant", + principalColumn: "Id"); + migrationBuilder.AddForeignKey( + name: "FK_DeviceGraphs_Customer_CustomerId", + table: "DeviceGraphs", + column: "CustomerId", + principalTable: "Customer", + principalColumn: "Id"); + migrationBuilder.AddForeignKey( + name: "FK_DeviceGraphs_Tenant_TenantId", + table: "DeviceGraphs", + column: "TenantId", + principalTable: "Tenant", + principalColumn: "Id"); - + migrationBuilder.AddForeignKey( + name: "FK_DeviceGraphToolBoxes_Customer_CustomerId", + table: "DeviceGraphToolBoxes", + column: "CustomerId", + principalTable: "Customer", + principalColumn: "Id"); + migrationBuilder.AddForeignKey( + name: "FK_DeviceGraphToolBoxes_Tenant_TenantId", + table: "DeviceGraphToolBoxes", + column: "TenantId", + principalTable: "Tenant", + principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_DeviceIdentities_Device_DeviceId", diff --git a/IoTSharp.Data.MySQL/Migrations/ApplicationDbContextModelSnapshot.cs b/IoTSharp.Data.MySQL/Migrations/ApplicationDbContextModelSnapshot.cs index bb872b89db99f091521c0176c80836b9ebd5f4dc..a9f682c6ebf23d944b82d613000817ead7f3c608 100644 --- a/IoTSharp.Data.MySQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/IoTSharp.Data.MySQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -717,7 +717,8 @@ namespace IoTSharp.Data.MySql.Migrations b.HasKey("Id"); - + b.HasIndex("DeviceId") + .IsUnique(); b.ToTable("DeviceIdentities"); }); diff --git a/IoTSharp/appsettings.MySql.json b/IoTSharp/appsettings.MySql.json index cc4fe9fe67e7eab0f5dea8f160e6fa4983e50ba9..7e9e311c0e5f2414648b099413cf24278bd875e3 100644 --- a/IoTSharp/appsettings.MySql.json +++ b/IoTSharp/appsettings.MySql.json @@ -8,8 +8,8 @@ }, "DataBase": "MySql", "ConnectionStrings": { - "IoTSharp": "server=localhost;user=root;password=kissme;database=IoTSharp1", - "TelemetryStorage": "server=localhost;user=root;password=kissme;database=IoTSharp1" + "IoTSharp": "server=localhost;user=root;password=kissme;database=IoTSharp10", + "TelemetryStorage": "server=localhost;user=root;password=kissme;database=IoTSharp10" }, "JwtKey": "kissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissme", "JwtExpireHours": 3,