设备升级记录与设备固件管理接口搭建

This commit is contained in:
ChenYi 2025-12-29 17:24:05 +08:00
parent 1283b48de7
commit 8839ab1896
5 changed files with 214 additions and 4044 deletions

View File

@ -1,160 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JiShe.IoT.Migrations
{
/// <inheritdoc />
public partial class DeviceFirmwareInfo : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "FirmwareVersion",
table: "ServiceProDeviceInfo",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<DateTime>(
name: "UpgradeDate",
table: "ServiceProDeviceInfo",
type: "datetime(6)",
nullable: true);
migrationBuilder.CreateTable(
name: "ServiceProDeviceFirmwareInfo",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ProductDataId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "产品数据Id", collation: "ascii_general_ci"),
IoTPlatform = table.Column<int>(type: "int", nullable: false, comment: "物联网平台类型"),
IoTPlatformProductId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品Id")
.Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformProductName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, comment: "物联网平台中对应的产品名称")
.Annotation("MySql:CharSet", "utf8mb4"),
FirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
FirmwareStorageAddress = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "指令设备端物模型的属性名称集合固件地址")
.Annotation("MySql:CharSet", "utf8mb4"),
IsEnable = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否启用"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsDeleted = table.Column<bool>(type: "bit(1)", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "租户ID", collation: "ascii_general_ci"),
Remark = table.Column<string>(type: "longtext", nullable: true, comment: "备注")
.Annotation("MySql:CharSet", "utf8mb4"),
OSACreatorId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权创建者Id"),
OSALastModifierId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后修改者Id"),
OSADeleterId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后删除者Id"),
ExtraProperties = table.Column<string>(type: "longtext", nullable: true, comment: "扩展属性,用于存储自定义字段,JSON格式")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_ServiceProDeviceFirmwareInfo", x => x.Id);
},
comment: "设备固件信息")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ServiceProDeviceUpgradeRecord",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DeviceDataId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "设备数据Id", collation: "ascii_general_ci"),
DeviceName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "设备名称")
.Annotation("MySql:CharSet", "utf8mb4"),
DeviceAddress = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "设备地址")
.Annotation("MySql:CharSet", "utf8mb4"),
OldFirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "旧的固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
NowFirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "当前固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
UpgradeDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
UpgradeSource = table.Column<int>(type: "int", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsDeleted = table.Column<bool>(type: "bit(1)", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "租户ID", collation: "ascii_general_ci"),
Remark = table.Column<string>(type: "longtext", nullable: true, comment: "备注")
.Annotation("MySql:CharSet", "utf8mb4"),
OSACreatorId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权创建者Id"),
OSALastModifierId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后修改者Id"),
OSADeleterId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后删除者Id"),
ExtraProperties = table.Column<string>(type: "longtext", nullable: true, comment: "扩展属性,用于存储自定义字段,JSON格式")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_ServiceProDeviceUpgradeRecord", x => x.Id);
},
comment: "设备升级记录")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceFirmwareInfo_CreationTime",
table: "ServiceProDeviceFirmwareInfo",
column: "CreationTime");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceFirmwareInfo_IoTPlatformProductId",
table: "ServiceProDeviceFirmwareInfo",
column: "IoTPlatformProductId");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceFirmwareInfo_IsNotUniqueKey",
table: "ServiceProDeviceFirmwareInfo",
columns: new[] { "Id", "IoTPlatformProductId", "FirmwareVersion", "CreationTime" },
descending: new bool[0]);
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceUpgradeRecord_CreationTime",
table: "ServiceProDeviceUpgradeRecord",
column: "CreationTime");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceUpgradeRecord_DeviceDataId",
table: "ServiceProDeviceUpgradeRecord",
column: "DeviceDataId");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceUpgradeRecord_IsNotUniqueKey",
table: "ServiceProDeviceUpgradeRecord",
columns: new[] { "Id", "DeviceDataId", "NowFirmwareVersion", "CreationTime" },
descending: new bool[0]);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ServiceProDeviceFirmwareInfo");
migrationBuilder.DropTable(
name: "ServiceProDeviceUpgradeRecord");
migrationBuilder.DropColumn(
name: "FirmwareVersion",
table: "ServiceProDeviceInfo");
migrationBuilder.DropColumn(
name: "UpgradeDate",
table: "ServiceProDeviceInfo");
}
}
}

View File

@ -13,8 +13,8 @@ using Volo.Abp.EntityFrameworkCore;
namespace JiShe.IoT.Migrations namespace JiShe.IoT.Migrations
{ {
[DbContext(typeof(IoTDbContext))] [DbContext(typeof(IoTDbContext))]
[Migration("20251225091437_DeviceFirmwareInfo")] [Migration("20251229083115_InitialCreate")]
partial class DeviceFirmwareInfo partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -297,9 +297,8 @@ namespace JiShe.IoT.Migrations
b.Property<int>("DeviceCount") b.Property<int>("DeviceCount")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("DeviceThingModelFileId") b.Property<Guid?>("DeviceThingModelFileId")
.HasMaxLength(50) .HasColumnType("char(36)")
.HasColumnType("varchar(50)")
.HasComment("设备物模型文件Id"); .HasComment("设备物模型文件Id");
b.Property<string>("DeviceThingModelFileName") b.Property<string>("DeviceThingModelFileName")
@ -590,11 +589,21 @@ namespace JiShe.IoT.Migrations
.HasColumnName("ExtraProperties") .HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式"); .HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<string>("FirmwareStorageAddress") b.Property<Guid?>("FirmwareFileId")
.HasColumnType("char(36)")
.HasComment("固件文件Id");
b.Property<string>("FirmwareFileName")
.IsRequired() .IsRequired()
.HasMaxLength(1024) .HasMaxLength(256)
.HasColumnType("varchar(1024)") .HasColumnType("varchar(256)")
.HasComment("指令设备端物模型的属性名称集合固件地址"); .HasComment("固件文件名称");
b.Property<string>("FirmwareHashCode")
.HasColumnType("longtext");
b.Property<long>("FirmwareLength")
.HasColumnType("bigint");
b.Property<string>("FirmwareVersion") b.Property<string>("FirmwareVersion")
.IsRequired() .IsRequired()
@ -744,7 +753,9 @@ namespace JiShe.IoT.Migrations
.HasComment("扩展属性,用于存储自定义字段,JSON格式"); .HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<string>("FirmwareVersion") b.Property<string>("FirmwareVersion")
.HasColumnType("longtext"); .HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("固件版本");
b.Property<int>("IoTPlatform") b.Property<int>("IoTPlatform")
.HasColumnType("int") .HasColumnType("int")
@ -836,7 +847,8 @@ namespace JiShe.IoT.Migrations
.HasComment("租户ID"); .HasComment("租户ID");
b.Property<DateTime?>("UpgradeDate") b.Property<DateTime?>("UpgradeDate")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)")
.HasComment("升级日期");
b.HasKey("Id"); b.HasKey("Id");
@ -902,6 +914,9 @@ namespace JiShe.IoT.Migrations
.HasColumnName("ExtraProperties") .HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式"); .HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<string>("FirmwareSignature")
.HasColumnType("longtext");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit(1)") .HasColumnType("bit(1)")
@ -952,9 +967,21 @@ namespace JiShe.IoT.Migrations
b.Property<DateTime>("UpgradeDate") b.Property<DateTime>("UpgradeDate")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
b.Property<long>("UpgradeIdentifier")
.HasColumnType("bigint");
b.Property<string>("UpgradeMessage")
.HasColumnType("longtext");
b.Property<int?>("UpgradeResult")
.HasColumnType("int");
b.Property<int>("UpgradeSource") b.Property<int>("UpgradeSource")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("UpgradeStatus")
.HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreationTime"); b.HasIndex("CreationTime");
@ -2225,9 +2252,8 @@ namespace JiShe.IoT.Migrations
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
.HasColumnName("DeletionTime"); .HasColumnName("DeletionTime");
b.Property<string>("DeviceThingModelFileId") b.Property<Guid?>("DeviceThingModelFileId")
.HasMaxLength(50) .HasColumnType("char(36)")
.HasColumnType("varchar(50)")
.HasComment("设备物模型文件Id"); .HasComment("设备物模型文件Id");
b.Property<string>("DeviceThingModelFileName") b.Property<string>("DeviceThingModelFileName")

View File

@ -845,8 +845,7 @@ namespace JiShe.IoT.Migrations
TupDeviceModel = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "设备型号") TupDeviceModel = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: true, comment: "设备型号")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
DeviceCount = table.Column<int>(type: "int", nullable: false), DeviceCount = table.Column<int>(type: "int", nullable: false),
DeviceThingModelFileId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "设备物模型文件Id") DeviceThingModelFileId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "设备物模型文件Id", collation: "ascii_general_ci"),
.Annotation("MySql:CharSet", "utf8mb4"),
DeviceThingModelFileName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "设备物模型文件名称") DeviceThingModelFileName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "设备物模型文件名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IsEnabled = table.Column<bool>(type: "bit(1)", nullable: false, comment: "是否启用"), IsEnabled = table.Column<bool>(type: "bit(1)", nullable: false, comment: "是否启用"),
@ -875,6 +874,51 @@ namespace JiShe.IoT.Migrations
comment: "CTWing产品信息") comment: "CTWing产品信息")
.Annotation("MySql:CharSet", "utf8mb4"); .Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ServiceProDeviceFirmwareInfo",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ProductDataId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "产品数据Id", collation: "ascii_general_ci"),
IoTPlatform = table.Column<int>(type: "int", nullable: false, comment: "物联网平台类型"),
IoTPlatformProductId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品Id")
.Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformProductName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, comment: "物联网平台中对应的产品名称")
.Annotation("MySql:CharSet", "utf8mb4"),
FirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
FirmwareFileId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "固件文件Id", collation: "ascii_general_ci"),
FirmwareFileName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, comment: "固件文件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
FirmwareHashCode = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
FirmwareLength = table.Column<long>(type: "bigint", nullable: false),
IsEnable = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否启用"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsDeleted = table.Column<bool>(type: "bit(1)", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "租户ID", collation: "ascii_general_ci"),
Remark = table.Column<string>(type: "longtext", nullable: true, comment: "备注")
.Annotation("MySql:CharSet", "utf8mb4"),
OSACreatorId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权创建者Id"),
OSALastModifierId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后修改者Id"),
OSADeleterId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后删除者Id"),
ExtraProperties = table.Column<string>(type: "longtext", nullable: true, comment: "扩展属性,用于存储自定义字段,JSON格式")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_ServiceProDeviceFirmwareInfo", x => x.Id);
},
comment: "设备固件信息")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ServiceProDeviceInfo", name: "ServiceProDeviceInfo",
columns: table => new columns: table => new
@ -907,6 +951,9 @@ namespace JiShe.IoT.Migrations
DeviceSource = table.Column<int>(type: "int", nullable: false, comment: "设备来源类型"), DeviceSource = table.Column<int>(type: "int", nullable: false, comment: "设备来源类型"),
IsNeedConfigDevicMdoel = table.Column<bool>(type: "bit(1)", nullable: false, comment: "是否需要配置设备模型"), IsNeedConfigDevicMdoel = table.Column<bool>(type: "bit(1)", nullable: false, comment: "是否需要配置设备模型"),
DeviceThingModelDataId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "设备物模型数据Id", collation: "ascii_general_ci"), DeviceThingModelDataId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "设备物模型数据Id", collation: "ascii_general_ci"),
FirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
UpgradeDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "升级日期"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
@ -1065,6 +1112,54 @@ namespace JiShe.IoT.Migrations
comment: "设备端物模型属性信息,是指设备端支持的属性或者事件") comment: "设备端物模型属性信息,是指设备端支持的属性或者事件")
.Annotation("MySql:CharSet", "utf8mb4"); .Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ServiceProDeviceUpgradeRecord",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DeviceDataId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "设备数据Id", collation: "ascii_general_ci"),
DeviceName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "设备名称")
.Annotation("MySql:CharSet", "utf8mb4"),
DeviceAddress = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "设备地址")
.Annotation("MySql:CharSet", "utf8mb4"),
OldFirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "旧的固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
NowFirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "当前固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
UpgradeDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
UpgradeSource = table.Column<int>(type: "int", nullable: false),
UpgradeMessage = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
UpgradeStatus = table.Column<int>(type: "int", nullable: false),
UpgradeIdentifier = table.Column<long>(type: "bigint", nullable: false),
FirmwareSignature = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
UpgradeResult = table.Column<int>(type: "int", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsDeleted = table.Column<bool>(type: "bit(1)", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "租户ID", collation: "ascii_general_ci"),
Remark = table.Column<string>(type: "longtext", nullable: true, comment: "备注")
.Annotation("MySql:CharSet", "utf8mb4"),
OSACreatorId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权创建者Id"),
OSALastModifierId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后修改者Id"),
OSADeleterId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后删除者Id"),
ExtraProperties = table.Column<string>(type: "longtext", nullable: true, comment: "扩展属性,用于存储自定义字段,JSON格式")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_ServiceProDeviceUpgradeRecord", x => x.Id);
},
comment: "设备升级记录")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ServiceProIoTPlatformThingModelInfo", name: "ServiceProIoTPlatformThingModelInfo",
columns: table => new columns: table => new
@ -1216,8 +1311,7 @@ namespace JiShe.IoT.Migrations
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
ProductAccesskey = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "产品访问密钥") ProductAccesskey = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "产品访问密钥")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
DeviceThingModelFileId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "设备物模型文件Id") DeviceThingModelFileId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "设备物模型文件Id", collation: "ascii_general_ci"),
.Annotation("MySql:CharSet", "utf8mb4"),
DeviceThingModelFileName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "设备物模型文件名称") DeviceThingModelFileName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true, comment: "设备物模型文件名称")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IsEnabled = table.Column<bool>(type: "bit(1)", nullable: false), IsEnabled = table.Column<bool>(type: "bit(1)", nullable: false),
@ -1924,6 +2018,22 @@ namespace JiShe.IoT.Migrations
columns: new[] { "Id", "IoTPlatformProductId", "ProductName", "CreationTime" }, columns: new[] { "Id", "IoTPlatformProductId", "ProductName", "CreationTime" },
descending: new bool[0]); descending: new bool[0]);
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceFirmwareInfo_CreationTime",
table: "ServiceProDeviceFirmwareInfo",
column: "CreationTime");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceFirmwareInfo_IoTPlatformProductId",
table: "ServiceProDeviceFirmwareInfo",
column: "IoTPlatformProductId");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceFirmwareInfo_IsNotUniqueKey",
table: "ServiceProDeviceFirmwareInfo",
columns: new[] { "Id", "IoTPlatformProductId", "FirmwareVersion", "CreationTime" },
descending: new bool[0]);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceInfo_CreationTime", name: "IX_ServiceProDeviceInfo_CreationTime",
table: "ServiceProDeviceInfo", table: "ServiceProDeviceInfo",
@ -1988,6 +2098,22 @@ namespace JiShe.IoT.Migrations
columns: new[] { "Id", "IoTPlatformProductId", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" }, columns: new[] { "Id", "IoTPlatformProductId", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" },
descending: new bool[0]); descending: new bool[0]);
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceUpgradeRecord_CreationTime",
table: "ServiceProDeviceUpgradeRecord",
column: "CreationTime");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceUpgradeRecord_DeviceDataId",
table: "ServiceProDeviceUpgradeRecord",
column: "DeviceDataId");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceUpgradeRecord_IsNotUniqueKey",
table: "ServiceProDeviceUpgradeRecord",
columns: new[] { "Id", "DeviceDataId", "NowFirmwareVersion", "CreationTime" },
descending: new bool[0]);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ServiceProIoTPlatformThingModelInfo_CreationTime", name: "IX_ServiceProIoTPlatformThingModelInfo_CreationTime",
table: "ServiceProIoTPlatformThingModelInfo", table: "ServiceProIoTPlatformThingModelInfo",
@ -2161,6 +2287,9 @@ namespace JiShe.IoT.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ServiceProCTWingPrivateProductInfo"); name: "ServiceProCTWingPrivateProductInfo");
migrationBuilder.DropTable(
name: "ServiceProDeviceFirmwareInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ServiceProDeviceInfo"); name: "ServiceProDeviceInfo");
@ -2173,6 +2302,9 @@ namespace JiShe.IoT.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ServiceProDeviceThingModelPropertylInfo"); name: "ServiceProDeviceThingModelPropertylInfo");
migrationBuilder.DropTable(
name: "ServiceProDeviceUpgradeRecord");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ServiceProIoTPlatformThingModelInfo"); name: "ServiceProIoTPlatformThingModelInfo");

View File

@ -294,9 +294,8 @@ namespace JiShe.IoT.Migrations
b.Property<int>("DeviceCount") b.Property<int>("DeviceCount")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("DeviceThingModelFileId") b.Property<Guid?>("DeviceThingModelFileId")
.HasMaxLength(50) .HasColumnType("char(36)")
.HasColumnType("varchar(50)")
.HasComment("设备物模型文件Id"); .HasComment("设备物模型文件Id");
b.Property<string>("DeviceThingModelFileName") b.Property<string>("DeviceThingModelFileName")
@ -587,11 +586,21 @@ namespace JiShe.IoT.Migrations
.HasColumnName("ExtraProperties") .HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式"); .HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<string>("FirmwareStorageAddress") b.Property<Guid?>("FirmwareFileId")
.HasColumnType("char(36)")
.HasComment("固件文件Id");
b.Property<string>("FirmwareFileName")
.IsRequired() .IsRequired()
.HasMaxLength(1024) .HasMaxLength(256)
.HasColumnType("varchar(1024)") .HasColumnType("varchar(256)")
.HasComment("指令设备端物模型的属性名称集合固件地址"); .HasComment("固件文件名称");
b.Property<string>("FirmwareHashCode")
.HasColumnType("longtext");
b.Property<long>("FirmwareLength")
.HasColumnType("bigint");
b.Property<string>("FirmwareVersion") b.Property<string>("FirmwareVersion")
.IsRequired() .IsRequired()
@ -741,7 +750,9 @@ namespace JiShe.IoT.Migrations
.HasComment("扩展属性,用于存储自定义字段,JSON格式"); .HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<string>("FirmwareVersion") b.Property<string>("FirmwareVersion")
.HasColumnType("longtext"); .HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("固件版本");
b.Property<int>("IoTPlatform") b.Property<int>("IoTPlatform")
.HasColumnType("int") .HasColumnType("int")
@ -833,7 +844,8 @@ namespace JiShe.IoT.Migrations
.HasComment("租户ID"); .HasComment("租户ID");
b.Property<DateTime?>("UpgradeDate") b.Property<DateTime?>("UpgradeDate")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)")
.HasComment("升级日期");
b.HasKey("Id"); b.HasKey("Id");
@ -899,6 +911,9 @@ namespace JiShe.IoT.Migrations
.HasColumnName("ExtraProperties") .HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式"); .HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<string>("FirmwareSignature")
.HasColumnType("longtext");
b.Property<bool>("IsDeleted") b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("bit(1)") .HasColumnType("bit(1)")
@ -949,9 +964,21 @@ namespace JiShe.IoT.Migrations
b.Property<DateTime>("UpgradeDate") b.Property<DateTime>("UpgradeDate")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
b.Property<long>("UpgradeIdentifier")
.HasColumnType("bigint");
b.Property<string>("UpgradeMessage")
.HasColumnType("longtext");
b.Property<int?>("UpgradeResult")
.HasColumnType("int");
b.Property<int>("UpgradeSource") b.Property<int>("UpgradeSource")
.HasColumnType("int"); .HasColumnType("int");
b.Property<int>("UpgradeStatus")
.HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreationTime"); b.HasIndex("CreationTime");
@ -2222,9 +2249,8 @@ namespace JiShe.IoT.Migrations
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
.HasColumnName("DeletionTime"); .HasColumnName("DeletionTime");
b.Property<string>("DeviceThingModelFileId") b.Property<Guid?>("DeviceThingModelFileId")
.HasMaxLength(50) .HasColumnType("char(36)")
.HasColumnType("varchar(50)")
.HasComment("设备物模型文件Id"); .HasComment("设备物模型文件Id");
b.Property<string>("DeviceThingModelFileName") b.Property<string>("DeviceThingModelFileName")