diff --git a/src/AzureIoTHub.Portal.MySql/Migrations/20230531104258_Add dataprotection + edge device external identifier.Designer.cs b/src/AzureIoTHub.Portal.MySql/Migrations/20230531104258_Add dataprotection + edge device external identifier.Designer.cs
new file mode 100644
index 000000000..6b37d2057
--- /dev/null
+++ b/src/AzureIoTHub.Portal.MySql/Migrations/20230531104258_Add dataprotection + edge device external identifier.Designer.cs
@@ -0,0 +1,604 @@
+//
+using System;
+using AzureIoTHub.Portal.Infrastructure;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace AzureIoTHub.Portal.MySql.Migrations
+{
+ [DbContext(typeof(PortalDbContext))]
+ [Migration("20230531104258_Add dataprotection + edge device external identifier")]
+ partial class Adddataprotectionedgedeviceexternalidentifier
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.5")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.Concentrator", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("ClientThumbprint")
+ .HasColumnType("longtext");
+
+ b.Property("DeviceType")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("IsConnected")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LoraRegion")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("Concentrators");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.Device", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("DeviceModelId")
+ .IsRequired()
+ .HasColumnType("varchar(255)");
+
+ b.Property("IsConnected")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("StatusUpdatedTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DeviceModelId");
+
+ b.ToTable("Devices", (string)null);
+
+ b.UseTptMappingStrategy();
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.DeviceModel", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("ABPRelaxMode")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("AppEUI")
+ .HasColumnType("longtext");
+
+ b.Property("ClassType")
+ .HasColumnType("int");
+
+ b.Property("Deduplication")
+ .HasColumnType("int");
+
+ b.Property("Description")
+ .HasColumnType("longtext");
+
+ b.Property("Downlink")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsBuiltin")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("KeepAliveTimeout")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("PreferredWindow")
+ .HasColumnType("int");
+
+ b.Property("RXDelay")
+ .HasColumnType("int");
+
+ b.Property("SensorDecoder")
+ .HasColumnType("longtext");
+
+ b.Property("SupportLoRaFeatures")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("UseOTAA")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("Id");
+
+ b.ToTable("DeviceModels");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.DeviceModelCommand", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Confirmed")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("DeviceModelId")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Frame")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("IsBuiltin")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Port")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("DeviceModelCommands");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.DeviceModelProperty", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("IsWritable")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ModelId")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.Property("PropertyType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("DeviceModelProperties");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.DeviceTag", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Label")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Required")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Searchable")
+ .HasColumnType("tinyint(1)");
+
+ b.HasKey("Id");
+
+ b.ToTable("DeviceTags");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.DeviceTagValue", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("DeviceId")
+ .HasColumnType("varchar(255)");
+
+ b.Property("EdgeDeviceId")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DeviceId");
+
+ b.HasIndex("EdgeDeviceId");
+
+ b.ToTable("DeviceTagValues");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.EdgeDevice", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("ConnectionState")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("DeviceModelId")
+ .IsRequired()
+ .HasColumnType("varchar(255)");
+
+ b.Property("IsEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("NbDevices")
+ .HasColumnType("int");
+
+ b.Property("NbModules")
+ .HasColumnType("int");
+
+ b.Property("Scope")
+ .HasColumnType("longtext");
+
+ b.Property("Version")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DeviceModelId");
+
+ b.ToTable("EdgeDevices");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.EdgeDeviceModel", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Description")
+ .HasColumnType("longtext");
+
+ b.Property("ExternalIdentifier")
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("EdgeDeviceModels");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.EdgeDeviceModelCommand", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("EdgeDeviceModelId")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ModuleName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("EdgeDeviceModelCommands");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.Label", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Color")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("DeviceId")
+ .HasColumnType("varchar(255)");
+
+ b.Property("DeviceModelId")
+ .HasColumnType("varchar(255)");
+
+ b.Property("EdgeDeviceId")
+ .HasColumnType("varchar(255)");
+
+ b.Property("EdgeDeviceModelId")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DeviceId");
+
+ b.HasIndex("DeviceModelId");
+
+ b.HasIndex("EdgeDeviceId");
+
+ b.HasIndex("EdgeDeviceModelId");
+
+ b.ToTable("Labels");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.LoRaDeviceTelemetry", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("varchar(255)");
+
+ b.Property("EnqueuedTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("LorawanDeviceId")
+ .HasColumnType("varchar(255)");
+
+ b.Property("Telemetry")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LorawanDeviceId");
+
+ b.ToTable("LoRaDeviceTelemetry");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("FriendlyName")
+ .HasColumnType("longtext");
+
+ b.Property("Xml")
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("DataProtectionKeys");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.LorawanDevice", b =>
+ {
+ b.HasBaseType("AzureIoTHub.Portal.Domain.Entities.Device");
+
+ b.Property("ABPRelaxMode")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("AlreadyLoggedInOnce")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("AppEUI")
+ .HasColumnType("longtext");
+
+ b.Property("AppKey")
+ .HasColumnType("longtext");
+
+ b.Property("AppSKey")
+ .HasColumnType("longtext");
+
+ b.Property("ClassType")
+ .HasColumnType("int");
+
+ b.Property("DataRate")
+ .HasColumnType("longtext");
+
+ b.Property("Deduplication")
+ .HasColumnType("int");
+
+ b.Property("DevAddr")
+ .HasColumnType("longtext");
+
+ b.Property("Downlink")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("FCntDownStart")
+ .HasColumnType("int");
+
+ b.Property("FCntResetCounter")
+ .HasColumnType("int");
+
+ b.Property("FCntUpStart")
+ .HasColumnType("int");
+
+ b.Property("GatewayID")
+ .HasColumnType("longtext");
+
+ b.Property("KeepAliveTimeout")
+ .HasColumnType("int");
+
+ b.Property("NbRep")
+ .HasColumnType("longtext");
+
+ b.Property("NwkSKey")
+ .HasColumnType("longtext");
+
+ b.Property("PreferredWindow")
+ .HasColumnType("int");
+
+ b.Property("RX1DROffset")
+ .HasColumnType("int");
+
+ b.Property("RX2DataRate")
+ .HasColumnType("int");
+
+ b.Property("RXDelay")
+ .HasColumnType("int");
+
+ b.Property("ReportedRX1DROffset")
+ .HasColumnType("longtext");
+
+ b.Property("ReportedRX2DataRate")
+ .HasColumnType("longtext");
+
+ b.Property("ReportedRXDelay")
+ .HasColumnType("longtext");
+
+ b.Property("SensorDecoder")
+ .HasColumnType("longtext");
+
+ b.Property("Supports32BitFCnt")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("TxPower")
+ .HasColumnType("longtext");
+
+ b.Property("UseOTAA")
+ .HasColumnType("tinyint(1)");
+
+ b.ToTable("LorawanDevices", (string)null);
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.Device", b =>
+ {
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.DeviceModel", "DeviceModel")
+ .WithMany()
+ .HasForeignKey("DeviceModelId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("DeviceModel");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.DeviceTagValue", b =>
+ {
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.Device", null)
+ .WithMany("Tags")
+ .HasForeignKey("DeviceId");
+
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.EdgeDevice", null)
+ .WithMany("Tags")
+ .HasForeignKey("EdgeDeviceId");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.EdgeDevice", b =>
+ {
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.EdgeDeviceModel", "DeviceModel")
+ .WithMany()
+ .HasForeignKey("DeviceModelId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("DeviceModel");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.Label", b =>
+ {
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.Device", null)
+ .WithMany("Labels")
+ .HasForeignKey("DeviceId");
+
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.DeviceModel", null)
+ .WithMany("Labels")
+ .HasForeignKey("DeviceModelId");
+
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.EdgeDevice", null)
+ .WithMany("Labels")
+ .HasForeignKey("EdgeDeviceId");
+
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.EdgeDeviceModel", null)
+ .WithMany("Labels")
+ .HasForeignKey("EdgeDeviceModelId");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.LoRaDeviceTelemetry", b =>
+ {
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.LorawanDevice", null)
+ .WithMany("Telemetry")
+ .HasForeignKey("LorawanDeviceId");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.LorawanDevice", b =>
+ {
+ b.HasOne("AzureIoTHub.Portal.Domain.Entities.Device", null)
+ .WithOne()
+ .HasForeignKey("AzureIoTHub.Portal.Domain.Entities.LorawanDevice", "Id")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.Device", b =>
+ {
+ b.Navigation("Labels");
+
+ b.Navigation("Tags");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.DeviceModel", b =>
+ {
+ b.Navigation("Labels");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.EdgeDevice", b =>
+ {
+ b.Navigation("Labels");
+
+ b.Navigation("Tags");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.EdgeDeviceModel", b =>
+ {
+ b.Navigation("Labels");
+ });
+
+ modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.LorawanDevice", b =>
+ {
+ b.Navigation("Telemetry");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/AzureIoTHub.Portal.MySql/Migrations/20230531104258_Add dataprotection + edge device external identifier.cs b/src/AzureIoTHub.Portal.MySql/Migrations/20230531104258_Add dataprotection + edge device external identifier.cs
new file mode 100644
index 000000000..8eab3b7b2
--- /dev/null
+++ b/src/AzureIoTHub.Portal.MySql/Migrations/20230531104258_Add dataprotection + edge device external identifier.cs
@@ -0,0 +1,50 @@
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace AzureIoTHub.Portal.MySql.Migrations
+{
+ ///
+ public partial class Adddataprotectionedgedeviceexternalidentifier : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "ExternalIdentifier",
+ table: "EdgeDeviceModels",
+ type: "longtext",
+ nullable: true)
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "DataProtectionKeys",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ FriendlyName = table.Column(type: "longtext", nullable: true)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Xml = table.Column(type: "longtext", nullable: true)
+ .Annotation("MySql:CharSet", "utf8mb4")
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_DataProtectionKeys", x => x.Id);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "DataProtectionKeys");
+
+ migrationBuilder.DropColumn(
+ name: "ExternalIdentifier",
+ table: "EdgeDeviceModels");
+ }
+ }
+}
diff --git a/src/AzureIoTHub.Portal.MySql/Migrations/PortalDbContextModelSnapshot.cs b/src/AzureIoTHub.Portal.MySql/Migrations/PortalDbContextModelSnapshot.cs
index dc3f31c7a..b3efd5e75 100644
--- a/src/AzureIoTHub.Portal.MySql/Migrations/PortalDbContextModelSnapshot.cs
+++ b/src/AzureIoTHub.Portal.MySql/Migrations/PortalDbContextModelSnapshot.cs
@@ -16,7 +16,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "7.0.2")
+ .HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.Concentrator", b =>
@@ -297,6 +297,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property("Description")
.HasColumnType("longtext");
+ b.Property("ExternalIdentifier")
+ .HasColumnType("longtext");
+
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
@@ -388,6 +391,23 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("LoRaDeviceTelemetry");
});
+ modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("FriendlyName")
+ .HasColumnType("longtext");
+
+ b.Property("Xml")
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("DataProtectionKeys");
+ });
+
modelBuilder.Entity("AzureIoTHub.Portal.Domain.Entities.LorawanDevice", b =>
{
b.HasBaseType("AzureIoTHub.Portal.Domain.Entities.Device");