// <auto-generated />
using System;
using IoTSharp.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Oracle.EntityFrameworkCore.Metadata;

#nullable disable

namespace IoTSharp.Data.Oracle.Migrations
{
    [DbContext(typeof(ApplicationDbContext))]
    [Migration("20220211164637_AddOracle2022")]
    partial class AddOracle2022
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "6.0.2")
                .HasAnnotation("Relational:MaxIdentifierLength", 30);

            OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);

            modelBuilder.Entity("IoTSharp.Data.AuditLog", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("ActionData")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ActionName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ActionResult")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime>("ActiveDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid?>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("ObjectID")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("ObjectName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("ObjectType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("UserId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("UserName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("Id");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("AuditLog");
                });

            modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("AuthToken")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid?>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("Id");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("AuthorizedKeys");
                });

            modelBuilder.Entity("IoTSharp.Data.BaseDictionary", b =>
                {
                    b.Property<long>("DictionaryId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)");

                    OraclePropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("DictionaryId"), 1L, 1);

                    b.Property<string>("Dictionary18NKeyName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryColor")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("DictionaryGroupId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("DictionaryIcon")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryPattern")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("DictionaryStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("DictionaryTag")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("DictionaryValueType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("DictionaryValueTypeName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("DictionaryId");

                    b.ToTable("BaseDictionaries");
                });

            modelBuilder.Entity("IoTSharp.Data.BaseDictionaryGroup", b =>
                {
                    b.Property<long>("DictionaryGroupId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)");

                    OraclePropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("DictionaryGroupId"), 1L, 1);

                    b.Property<string>("DictionaryGroup18NKeyName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryGroupDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryGroupKey")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryGroupName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("DictionaryGroupStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<int?>("DictionaryGroupValueType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("DictionaryGroupValueTypeName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("DictionaryGroupId");

                    b.ToTable("BaseDictionaryGroups");
                });

            modelBuilder.Entity("IoTSharp.Data.BaseEvent", b =>
                {
                    b.Property<Guid>("EventId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("BizData")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Bizid")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime>("CreaterDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("EventDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("EventName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("EventStaus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid?>("FlowRuleRuleId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("MataData")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("Type")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("EventId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("FlowRuleRuleId");

                    b.HasIndex("TenantId");

                    b.ToTable("BaseEvents");
                });

            modelBuilder.Entity("IoTSharp.Data.BaseI18N", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)");

                    OraclePropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);

                    b.Property<DateTime?>("AddDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("KeyName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ResouceDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("ResouceGroupId")
                        .HasColumnType("NUMBER(10)");

                    b.Property<long?>("ResourceId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("ResourceKey")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ResourceTag")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("ResourceType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<int>("Status")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid>("UserId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("ValueBG")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueCS")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueDA")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueDEDE")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueELGR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueENGR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueENUS")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueESES")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueFI")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueFRFR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueHE")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueHRHR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueHU")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueITIT")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueJAJP")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueKOKR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueNL")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValuePLPL")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValuePT")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueSLSL")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueSR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueSV")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueTRTR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueUK")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueVI")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueZHCN")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueZHTW")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("Id");

                    b.ToTable("BaseI18Ns");
                });

            modelBuilder.Entity("IoTSharp.Data.Customer", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("Address")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("City")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Country")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Email")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Phone")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Province")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Street")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("ZipCode")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("Id");

                    b.HasIndex("TenantId");

                    b.ToTable("Customer");
                });

            modelBuilder.Entity("IoTSharp.Data.DataStorage", b =>
                {
                    b.Property<int>("Catalog")
                        .HasColumnType("NUMBER(10)")
                        .HasColumnOrder(0);

                    b.Property<Guid>("DeviceId")
                        .HasColumnType("RAW(16)")
                        .HasColumnOrder(1);

                    b.Property<string>("KeyName")
                        .HasColumnType("NVARCHAR2(450)")
                        .HasColumnOrder(2);

                    b.Property<int>("DataSide")
                        .HasColumnType("NUMBER(10)")
                        .HasColumnOrder(4);

                    b.Property<DateTime>("DateTime")
                        .HasColumnType("TIMESTAMP(7)")
                        .HasColumnOrder(3);

                    b.Property<int>("Type")
                        .HasColumnType("NUMBER(10)")
                        .HasColumnOrder(5);

                    b.Property<byte[]>("Value_Binary")
                        .HasColumnType("RAW(2000)");

                    b.Property<bool?>("Value_Boolean")
                        .HasColumnType("NUMBER(1)");

                    b.Property<DateTime?>("Value_DateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<double?>("Value_Double")
                        .HasColumnType("BINARY_DOUBLE");

                    b.Property<string>("Value_Json")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("Value_Long")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("Value_String")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Value_XML")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("Catalog", "DeviceId", "KeyName");

                    b.HasIndex("Catalog");

                    b.HasIndex("Catalog", "DeviceId");

                    b.ToTable("DataStorage");

                    b.HasDiscriminator<int>("Catalog").HasValue(0);
                });

            modelBuilder.Entity("IoTSharp.Data.Device", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("AuthorizedKeyId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("DeviceModelId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("DeviceType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<DateTime>("LastActive")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<bool>("Online")
                        .HasColumnType("NUMBER(1)");

                    b.Property<Guid?>("OwnerId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("Status")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("Timeout")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("Id");

                    b.HasIndex("AuthorizedKeyId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("DeviceModelId");

                    b.HasIndex("OwnerId");

                    b.HasIndex("TenantId");

                    b.ToTable("Device");

                    b.HasDiscriminator<int>("DeviceType").HasValue(0);
                });

            modelBuilder.Entity("IoTSharp.Data.DeviceDiagram", b =>
                {
                    b.Property<Guid>("DiagramId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTimeOffset?>("CreateDate")
                        .HasColumnType("TIMESTAMP(7) WITH TIME ZONE");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("DiagramDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DiagramImage")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DiagramName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("DiagramStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<bool?>("IsDefault")
                        .HasColumnType("NUMBER(1)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("DiagramId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("DeviceDiagrams");
                });

            modelBuilder.Entity("IoTSharp.Data.DeviceGraph", b =>
                {
                    b.Property<Guid>("GraphId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime?>("CreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("DeviceDiagramDiagramId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("DeviceId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("GraphElementId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("GraphFill")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<decimal?>("GraphHeight")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<decimal?>("GraphPostionX")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<decimal?>("GraphPostionY")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<string>("GraphShape")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("GraphStroke")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<decimal?>("GraphStrokeWidth")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<string>("GraphTextAnchor")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("GraphTextFill")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("GraphTextFontFamily")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<decimal?>("GraphTextFontSize")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<decimal?>("GraphTextRefX")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<decimal?>("GraphTextRefY")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<string>("GraphTextVerticalAnchor")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<decimal?>("GraphWidth")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("GraphId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("DeviceDiagramDiagramId");

                    b.HasIndex("TenantId");

                    b.ToTable("DeviceGraphs");
                });

            modelBuilder.Entity("IoTSharp.Data.DeviceGraphToolBox", b =>
                {
                    b.Property<Guid>("ToolBoxId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("CommondParam")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("CommondType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime?>("CreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<long?>("DeviceId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("ToolBoxIcon")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ToolBoxName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<decimal?>("ToolBoxOffsetLeftPer")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<decimal?>("ToolBoxOffsetTopPer")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<decimal?>("ToolBoxOffsetX")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<decimal?>("ToolBoxOffsetY")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<string>("ToolBoxRequestUri")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("ToolBoxStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("ToolBoxType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("ToolBoxId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("DeviceGraphToolBoxes");
                });

            modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("DeviceId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("IdentityId")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("IdentityType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("IdentityValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("Id");

                    b.HasIndex("DeviceId")
                        .IsUnique();

                    b.ToTable("DeviceIdentities");
                });

            modelBuilder.Entity("IoTSharp.Data.DeviceModel", b =>
                {
                    b.Property<Guid>("DeviceModelId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime>("CreateDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("ModelDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ModelName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("ModelStatus")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("DeviceModelId");

                    b.ToTable("DeviceModels");
                });

            modelBuilder.Entity("IoTSharp.Data.DeviceModelCommand", b =>
                {
                    b.Property<Guid>("CommandId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("CommandI18N")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("CommandName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("CommandParams")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("CommandStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("CommandTemplate")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("CommandTitle")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("CommandType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<DateTime>("CreateDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("DeviceModelId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("CommandId");

                    b.HasIndex("DeviceModelId");

                    b.ToTable("DeviceModelCommands");
                });

            modelBuilder.Entity("IoTSharp.Data.DevicePort", b =>
                {
                    b.Property<Guid>("PortId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime?>("CreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<long?>("Creator")
                        .HasColumnType("NUMBER(19)");

                    b.Property<Guid>("DeviceId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("PortDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("PortElementId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("PortName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("PortPhyType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("PortPic")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("PortStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<int?>("PortType")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("PortId");

                    b.ToTable("DevicePorts");
                });

            modelBuilder.Entity("IoTSharp.Data.DevicePortMapping", b =>
                {
                    b.Property<Guid>("MappingId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime?>("CreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<decimal?>("MappingIndex")
                        .HasColumnType("DECIMAL(18, 2)");

                    b.Property<int?>("MappingStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid>("SourceDeviceId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("SourceElementId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("SourceId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("TargeId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid>("TargetDeviceId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("TargetElementId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("MappingId");

                    b.ToTable("DevicePortMappings");
                });

            modelBuilder.Entity("IoTSharp.Data.DeviceRule", b =>
                {
                    b.Property<Guid>("DeviceRuleId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime>("ConfigDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("ConfigUser")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("DeviceId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("EnableTrace")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid?>("FlowRuleRuleId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("DeviceRuleId");

                    b.HasIndex("DeviceId");

                    b.HasIndex("FlowRuleRuleId");

                    b.ToTable("DeviceRules");
                });

            modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b =>
                {
                    b.Property<long>("FieldId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)");

                    OraclePropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("FieldId"), 1L, 1);

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("FieldCode")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime?>("FieldCreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<DateTime?>("FieldEditDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("FieldI18nKey")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("FieldMaxLength")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("FieldName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldPattern")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldPocoTypeName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("FieldStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<long?>("FieldUIElement")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("FieldUIElementSchema")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldUnit")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldValueDataSource")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldValueLocalDataSource")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("FieldValueType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("FieldValueTypeName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("FormId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<bool?>("IsEnabled")
                        .HasColumnType("NUMBER(1)");

                    b.Property<bool?>("IsRequired")
                        .HasColumnType("NUMBER(1)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("FieldId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("DynamicFormFieldInfos");
                });

            modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldValueInfo", b =>
                {
                    b.Property<long>("FieldValueId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)");

                    OraclePropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("FieldValueId"), 1L, 1);

                    b.Property<long?>("BizId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("FieldCode")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime?>("FieldCreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<long?>("FieldId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("FieldName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldUnit")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("FieldValueType")
                        .HasColumnType("NUMBER(19)");

                    b.Property<long?>("FromId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("FieldValueId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId")
                        .HasDatabaseName("IX_DynamicFormFieldValueInfo~1");

                    b.ToTable("DynamicFormFieldValueInfos");
                });

            modelBuilder.Entity("IoTSharp.Data.DynamicFormInfo", b =>
                {
                    b.Property<long>("FormId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)");

                    OraclePropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("FormId"), 1L, 1);

                    b.Property<long?>("BizId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<long?>("FormCreator")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("FormDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FormLayout")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FormName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FormSchame")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("FormStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<DateTime?>("FromCreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<bool>("IsCompact")
                        .HasColumnType("NUMBER(1)");

                    b.Property<string>("ModelClass")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("Url")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("FormId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("DynamicFormInfos");
                });

            modelBuilder.Entity("IoTSharp.Data.Flow", b =>
                {
                    b.Property<Guid>("FlowId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("Conditionexpression")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime>("CreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("CreateId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("Createor")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("ExecutorId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("FlowRuleRuleId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("FlowStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("FlowType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Flowdesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Flowname")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Incoming")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessClass")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessMethod")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessParams")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessScript")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessScriptType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ObjectId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Outgoing")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("SourceId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("TargetId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("TestStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid>("Tester")
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime>("TesterDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("bpmnid")
                        .HasColumnType("NVARCHAR2(2000)");

                    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<Guid>("OperationId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime?>("AddDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("BaseEventId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("BizId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Data")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid>("FlowId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("FlowRuleId")
                        .HasColumnType("RAW(16)");

                    b.Property<int?>("NodeStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("OperationDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("Step")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("Tag")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("bpmnid")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("OperationId");

                    b.HasIndex("BaseEventId");

                    b.HasIndex("FlowId");

                    b.HasIndex("FlowRuleId");

                    b.ToTable("FlowOperations");
                });

            modelBuilder.Entity("IoTSharp.Data.FlowRule", b =>
                {
                    b.Property<Guid>("RuleId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime?>("CreatTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("CreateId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("Creator")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("DefinitionsXml")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Describes")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ExecutableCode")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("MountType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid>("ParentRuleId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("RuleDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("RuleStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<int>("RuleType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("Runner")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<double>("SubVersion")
                        .HasColumnType("BINARY_DOUBLE");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<double>("Version")
                        .HasColumnType("BINARY_DOUBLE");

                    b.HasKey("RuleId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("FlowRules");
                });

            modelBuilder.Entity("IoTSharp.Data.RefreshToken", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime>("AddedDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<DateTime>("ExpiryDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<bool>("IsRevorked")
                        .HasColumnType("NUMBER(1)");

                    b.Property<bool>("IsUsed")
                        .HasColumnType("NUMBER(1)");

                    b.Property<string>("JwtId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Token")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("UserId")
                        .HasColumnType("NVARCHAR2(450)");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("RefreshTokens");
                });

            modelBuilder.Entity("IoTSharp.Data.Relationship", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("IdentityUserId")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("Id");

                    b.HasIndex("CustomerId");

                    b.HasIndex("IdentityUserId");

                    b.HasIndex("TenantId");

                    b.ToTable("Relationship");
                });

            modelBuilder.Entity("IoTSharp.Data.RuleTaskExecutor", b =>
                {
                    b.Property<Guid>("ExecutorId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime>("AddDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("DefaultConfig")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ExecutorDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ExecutorName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("ExecutorStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("MataData")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Path")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Tag")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("TestStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid>("Tester")
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime>("TesterDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("TypeName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("ExecutorId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("RuleTaskExecutors");
                });

            modelBuilder.Entity("IoTSharp.Data.SubscriptionEvent", b =>
                {
                    b.Property<Guid>("EventId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<DateTime>("CreateDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("EventDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("EventName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("EventNameSpace")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("EventParam")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("EventStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("EventTag")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("Type")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("EventId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("SubscriptionEvents");
                });

            modelBuilder.Entity("IoTSharp.Data.SubscriptionTask", b =>
                {
                    b.Property<Guid>("BindId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("EventId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("RuleTaskExecutorExecutorId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("Status")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid?>("SubscriptionEventId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("TaskConfig")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("BindId");

                    b.HasIndex("RuleTaskExecutorExecutorId");

                    b.HasIndex("SubscriptionEventId");

                    b.ToTable("SubscriptionTasks");
                });

            modelBuilder.Entity("IoTSharp.Data.TelemetryData", b =>
                {
                    b.Property<Guid>("DeviceId")
                        .HasColumnType("RAW(16)")
                        .HasColumnOrder(1);

                    b.Property<string>("KeyName")
                        .HasColumnType("NVARCHAR2(450)")
                        .HasColumnOrder(2);

                    b.Property<DateTime>("DateTime")
                        .HasColumnType("TIMESTAMP(7)")
                        .HasColumnOrder(3);

                    b.Property<int>("DataSide")
                        .HasColumnType("NUMBER(10)")
                        .HasColumnOrder(4);

                    b.Property<int>("Type")
                        .HasColumnType("NUMBER(10)")
                        .HasColumnOrder(5);

                    b.Property<byte[]>("Value_Binary")
                        .HasColumnType("RAW(2000)");

                    b.Property<bool?>("Value_Boolean")
                        .HasColumnType("NUMBER(1)");

                    b.Property<DateTime?>("Value_DateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<double?>("Value_Double")
                        .HasColumnType("BINARY_DOUBLE");

                    b.Property<string>("Value_Json")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("Value_Long")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("Value_String")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Value_XML")
                        .HasColumnType("NVARCHAR2(2000)");

                    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<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("Address")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("City")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Country")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("EMail")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Phone")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Province")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Street")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("ZipCode")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("Id");

                    b.ToTable("Tenant");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Name")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.Property<string>("NormalizedName")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedName")
                        .IsUnique()
                        .HasDatabaseName("RoleNameIndex")
                        .HasFilter("\"NormalizedName\" IS NOT NULL");

                    b.ToTable("AspNetRoles", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(10)");

                    OraclePropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

                    b.Property<string>("ClaimType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("RoleId")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(450)");

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetRoleClaims", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<int>("AccessFailedCount")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Email")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.Property<bool>("EmailConfirmed")
                        .HasColumnType("NUMBER(1)");

                    b.Property<bool>("LockoutEnabled")
                        .HasColumnType("NUMBER(1)");

                    b.Property<DateTimeOffset?>("LockoutEnd")
                        .HasColumnType("TIMESTAMP(7) WITH TIME ZONE");

                    b.Property<string>("NormalizedEmail")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.Property<string>("NormalizedUserName")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.Property<string>("PasswordHash")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("PhoneNumber")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<bool>("PhoneNumberConfirmed")
                        .HasColumnType("NUMBER(1)");

                    b.Property<string>("SecurityStamp")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<bool>("TwoFactorEnabled")
                        .HasColumnType("NUMBER(1)");

                    b.Property<string>("UserName")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedEmail")
                        .HasDatabaseName("EmailIndex");

                    b.HasIndex("NormalizedUserName")
                        .IsUnique()
                        .HasDatabaseName("UserNameIndex")
                        .HasFilter("\"NormalizedUserName\" IS NOT NULL");

                    b.ToTable("AspNetUsers", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(10)");

                    OraclePropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);

                    b.Property<string>("ClaimType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("UserId")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(450)");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserClaims", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                {
                    b.Property<string>("LoginProvider")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("ProviderKey")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("ProviderDisplayName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("UserId")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(450)");

                    b.HasKey("LoginProvider", "ProviderKey");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserLogins", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                {
                    b.Property<string>("UserId")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("RoleId")
                        .HasColumnType("NVARCHAR2(450)");

                    b.HasKey("UserId", "RoleId");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetUserRoles", (string)null);
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                {
                    b.Property<string>("UserId")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("LoginProvider")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("Value")
                        .HasColumnType("NVARCHAR2(2000)");

                    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()
                        .HasConstraintName("FK_DynamicFormFieldValueInfo~1");

                    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<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", 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<string>", 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
        }
    }
}
