From e048132dcd6602d667ffab76ab8210de0a7e546e Mon Sep 17 00:00:00 2001 From: hyh Date: Fri, 1 Aug 2025 15:57:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E6=89=80=E6=9C=89=E8=A1=A8=E5=90=8D?= =?UTF-8?q?=E4=B8=BAtb=5F=E5=BC=80=E5=A4=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除所有现有迁移文件 - 重新创建初始迁移文件 - 更新所有表名为tb_开头的小写下划线格式 - 修改的配置文件包括: * 设备相关表配置 * 身份认证相关表配置 * 权限相关表配置 * 网络配置相关表配置 * 日志相关表配置 - 更新modify.md记录修改历史 --- .../Device/CellularDeviceConfiguration.cs | 6 +- .../CellularDeviceRuntimeConfiguration.cs | 2 +- ...ellularDeviceRuntimeDetailConfiguration.cs | 2 +- .../Device/ProtocolVersionConfiguration.cs | 2 +- .../Identity/AppRoleConfiguration.cs | 2 +- .../Identity/AppUserConfiguration.cs | 8 +- .../Identity/UserRoleConfiguration.cs | 2 +- .../Logging/LoginLogConfiguration.cs | 2 +- .../Logging/ProtocolLogConfiguration.cs | 2 +- .../CoreNetworkConfigConfiguration.cs | 2 +- .../IMS_ConfigurationConfiguration.cs | 2 +- .../NetworkStackConfigConfiguration.cs | 2 +- .../RAN_ConfigurationConfiguration.cs | 2 +- .../Stack_CoreIMS_BindingConfiguration.cs | 2 +- .../Permission/PermissionConfiguration.cs | 2 +- .../Permission/RolePermissionConfiguration.cs | 2 +- .../20250728081332_InitialCreate.Designer.cs | 929 ------------------ ...eNetworkStackConfigAndBindings.Designer.cs | 909 ----------------- ...913_UpdateNetworkStackConfigAndBindings.cs | 266 ----- ...etworkCodeToNetworkStackConfig.Designer.cs | 923 ----------------- ...2128_AddNetworkCodeToNetworkStackConfig.cs | 52 - .../20250729144236_AddNetworkStackCode.cs | 76 -- ... 20250801075432_InitialCreate.Designer.cs} | 261 ++++- ...ate.cs => 20250801075432_InitialCreate.cs} | 396 +++++--- .../Migrations/AppDbContextModelSnapshot.cs | 257 ++++- .../device-runtimes/DeviceRuntimesTable.tsx | 21 +- .../device-runtimes/DeviceRuntimesView.tsx | 19 + src/modify.md | 64 +- 28 files changed, 875 insertions(+), 3340 deletions(-) delete mode 100644 src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.Designer.cs delete mode 100644 src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.Designer.cs delete mode 100644 src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.cs delete mode 100644 src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.Designer.cs delete mode 100644 src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.cs delete mode 100644 src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.cs rename src/X1.Infrastructure/Migrations/{20250729144236_AddNetworkStackCode.Designer.cs => 20250801075432_InitialCreate.Designer.cs} (78%) rename src/X1.Infrastructure/Migrations/{20250728081332_InitialCreate.cs => 20250801075432_InitialCreate.cs} (61%) diff --git a/src/X1.Infrastructure/Configurations/Device/CellularDeviceConfiguration.cs b/src/X1.Infrastructure/Configurations/Device/CellularDeviceConfiguration.cs index f1b9940..799f8f4 100644 --- a/src/X1.Infrastructure/Configurations/Device/CellularDeviceConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Device/CellularDeviceConfiguration.cs @@ -8,12 +8,12 @@ public class CellularDeviceConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("CellularDevices", t => t.HasComment("蜂窝设备表")); + builder.ToTable("tb_cellular_device", t => t.HasComment("蜂窝设备表")); builder.HasKey(d => d.Id); // 配置索引 - builder.HasIndex(d => d.SerialNumber).IsUnique().HasDatabaseName("IX_CellularDevices_SerialNumber"); - builder.HasIndex(d => d.DeviceCode).IsUnique().HasDatabaseName("IX_CellularDevices_DeviceCode"); + builder.HasIndex(d => d.SerialNumber).IsUnique().HasDatabaseName("IX_cellular_device_SerialNumber"); + builder.HasIndex(d => d.DeviceCode).IsUnique().HasDatabaseName("IX_cellular_device_DeviceCode"); // 配置属性 builder.Property(d => d.Id).HasComment("设备ID"); diff --git a/src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeConfiguration.cs b/src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeConfiguration.cs index 4caaba4..701dac1 100644 --- a/src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeConfiguration.cs @@ -11,7 +11,7 @@ public class CellularDeviceRuntimeConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("CellularDeviceRuntimes"); + builder.ToTable("tb_cellular_device_runtimes"); builder.HasKey(x => x.Id); diff --git a/src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeDetailConfiguration.cs b/src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeDetailConfiguration.cs index 4cc4206..fbcf651 100644 --- a/src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeDetailConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeDetailConfiguration.cs @@ -11,7 +11,7 @@ public class CellularDeviceRuntimeDetailConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { - builder.ToTable("CellularDeviceRuntimeDetails"); + builder.ToTable("tb_cellular_device_runtime_details"); builder.HasKey(x => x.Id); diff --git a/src/X1.Infrastructure/Configurations/Device/ProtocolVersionConfiguration.cs b/src/X1.Infrastructure/Configurations/Device/ProtocolVersionConfiguration.cs index a7c87ed..3a4ab4c 100644 --- a/src/X1.Infrastructure/Configurations/Device/ProtocolVersionConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Device/ProtocolVersionConfiguration.cs @@ -8,7 +8,7 @@ public class ProtocolVersionConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("ProtocolVersions", t => t.HasComment("协议版本表")); + builder.ToTable("tb_protocol_versions", t => t.HasComment("协议版本表")); builder.HasKey(v => v.Id); // 配置索引 diff --git a/src/X1.Infrastructure/Configurations/Identity/AppRoleConfiguration.cs b/src/X1.Infrastructure/Configurations/Identity/AppRoleConfiguration.cs index 0211a0e..ef2fa71 100644 --- a/src/X1.Infrastructure/Configurations/Identity/AppRoleConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Identity/AppRoleConfiguration.cs @@ -16,7 +16,7 @@ public sealed class AppRoleConfiguration : IEntityTypeConfiguration public void Configure(EntityTypeBuilder builder) { // 配置表名 - builder.ToTable("Roles", t => t.HasComment("角色表")); + builder.ToTable("tb_roles", t => t.HasComment("角色表")); // 配置索引 builder.HasIndex(r => r.Name) diff --git a/src/X1.Infrastructure/Configurations/Identity/AppUserConfiguration.cs b/src/X1.Infrastructure/Configurations/Identity/AppUserConfiguration.cs index 19a975c..b031f9f 100644 --- a/src/X1.Infrastructure/Configurations/Identity/AppUserConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Identity/AppUserConfiguration.cs @@ -17,12 +17,12 @@ public sealed class AppUserConfiguration : IEntityTypeConfiguration public void Configure(EntityTypeBuilder builder) { // 配置表名 - builder.ToTable("Users", t => t.HasComment("用户表")); + builder.ToTable("tb_users", t => t.HasComment("用户表")); // 配置索引 - builder.HasIndex(u => u.UserName).IsUnique().HasDatabaseName("IX_Users_UserName"); - builder.HasIndex(u => u.Email).IsUnique().HasDatabaseName("IX_Users_Email"); - builder.HasIndex(u => u.PhoneNumber).IsUnique().HasDatabaseName("IX_Users_PhoneNumber"); + builder.HasIndex(u => u.UserName).IsUnique().HasDatabaseName("IX_user_UserName"); + builder.HasIndex(u => u.Email).IsUnique().HasDatabaseName("IX_user_Email"); + builder.HasIndex(u => u.PhoneNumber).IsUnique().HasDatabaseName("IX_user_PhoneNumber"); builder.HasIndex(u => u.NormalizedEmail).HasDatabaseName("EmailIndex"); builder.HasIndex(u => u.NormalizedUserName).IsUnique().HasDatabaseName("UserNameIndex"); diff --git a/src/X1.Infrastructure/Configurations/Identity/UserRoleConfiguration.cs b/src/X1.Infrastructure/Configurations/Identity/UserRoleConfiguration.cs index b66911a..0fd3289 100644 --- a/src/X1.Infrastructure/Configurations/Identity/UserRoleConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Identity/UserRoleConfiguration.cs @@ -15,7 +15,7 @@ public sealed class UserRoleConfiguration : IEntityTypeConfiguration public void Configure(EntityTypeBuilder builder) { // 配置表名 - builder.ToTable("UserRoles", t => t.HasComment("用户角色关系表")); + builder.ToTable("tb_user_roles", t => t.HasComment("用户角色关系表")); // 配置主键 builder.HasKey(ur => new { ur.UserId, ur.RoleId }); diff --git a/src/X1.Infrastructure/Configurations/Logging/LoginLogConfiguration.cs b/src/X1.Infrastructure/Configurations/Logging/LoginLogConfiguration.cs index 5b540e0..c775903 100644 --- a/src/X1.Infrastructure/Configurations/Logging/LoginLogConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Logging/LoginLogConfiguration.cs @@ -18,7 +18,7 @@ public sealed class LoginLogConfiguration : IEntityTypeConfiguration public void Configure(EntityTypeBuilder builder) { // 配置表名 - builder.ToTable("LoginLogs", t => t.HasComment("用户登录日志表")); + builder.ToTable("tb_login_logs", t => t.HasComment("用户登录日志表")); // 配置主键 builder.HasKey(l => l.Id); diff --git a/src/X1.Infrastructure/Configurations/Logging/ProtocolLogConfiguration.cs b/src/X1.Infrastructure/Configurations/Logging/ProtocolLogConfiguration.cs index 8da0bf1..b536426 100644 --- a/src/X1.Infrastructure/Configurations/Logging/ProtocolLogConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Logging/ProtocolLogConfiguration.cs @@ -17,7 +17,7 @@ public sealed class ProtocolLogConfiguration : IEntityTypeConfiguration builder) { // 配置表名 - builder.ToTable("tb_ProtocolLog", t => t.HasComment("协议日志表")); + builder.ToTable("tb_protocol_logs", t => t.HasComment("协议日志表")); // 配置主键 builder.HasKey(p => p.Id); diff --git a/src/X1.Infrastructure/Configurations/NetworkProfile/CoreNetworkConfigConfiguration.cs b/src/X1.Infrastructure/Configurations/NetworkProfile/CoreNetworkConfigConfiguration.cs index b557969..7c3e315 100644 --- a/src/X1.Infrastructure/Configurations/NetworkProfile/CoreNetworkConfigConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/NetworkProfile/CoreNetworkConfigConfiguration.cs @@ -8,7 +8,7 @@ public class CoreNetworkConfigConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("CoreNetworkConfigs", t => t.HasComment("核心网配置表")); + builder.ToTable("tb_core_network_configs", t => t.HasComment("核心网配置表")); builder.HasKey(cnc => cnc.Id); // 配置索引 diff --git a/src/X1.Infrastructure/Configurations/NetworkProfile/IMS_ConfigurationConfiguration.cs b/src/X1.Infrastructure/Configurations/NetworkProfile/IMS_ConfigurationConfiguration.cs index eb389e7..114255b 100644 --- a/src/X1.Infrastructure/Configurations/NetworkProfile/IMS_ConfigurationConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/NetworkProfile/IMS_ConfigurationConfiguration.cs @@ -8,7 +8,7 @@ public class IMS_ConfigurationConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("IMS_Configurations", t => t.HasComment("IMS配置表")); + builder.ToTable("tb_ims_configurations", t => t.HasComment("IMS配置表")); builder.HasKey(ic => ic.Id); // 配置索引 diff --git a/src/X1.Infrastructure/Configurations/NetworkProfile/NetworkStackConfigConfiguration.cs b/src/X1.Infrastructure/Configurations/NetworkProfile/NetworkStackConfigConfiguration.cs index 830750b..536264e 100644 --- a/src/X1.Infrastructure/Configurations/NetworkProfile/NetworkStackConfigConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/NetworkProfile/NetworkStackConfigConfiguration.cs @@ -8,7 +8,7 @@ public class NetworkStackConfigConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("NetworkStackConfigs", t => t.HasComment("网络栈配置表")); + builder.ToTable("tb_network_stack_configs", t => t.HasComment("网络栈配置表")); builder.HasKey(nsc => nsc.Id); // 配置索引 diff --git a/src/X1.Infrastructure/Configurations/NetworkProfile/RAN_ConfigurationConfiguration.cs b/src/X1.Infrastructure/Configurations/NetworkProfile/RAN_ConfigurationConfiguration.cs index 95fd374..9775723 100644 --- a/src/X1.Infrastructure/Configurations/NetworkProfile/RAN_ConfigurationConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/NetworkProfile/RAN_ConfigurationConfiguration.cs @@ -9,7 +9,7 @@ public class RAN_ConfigurationConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("RAN_Configurations", t => t.HasComment("RAN配置表")); + builder.ToTable("tb_ran_configurations", t => t.HasComment("RAN配置表")); builder.HasKey(rc => rc.Id); // 配置索引 diff --git a/src/X1.Infrastructure/Configurations/NetworkProfile/Stack_CoreIMS_BindingConfiguration.cs b/src/X1.Infrastructure/Configurations/NetworkProfile/Stack_CoreIMS_BindingConfiguration.cs index de3e99b..7dcb923 100644 --- a/src/X1.Infrastructure/Configurations/NetworkProfile/Stack_CoreIMS_BindingConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/NetworkProfile/Stack_CoreIMS_BindingConfiguration.cs @@ -8,7 +8,7 @@ public class Stack_CoreIMS_BindingConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("Stack_CoreIMS_Bindings", t => t.HasComment("栈与核心网/IMS绑定关系表")); + builder.ToTable("tb_stack_core_ims_bindings", t => t.HasComment("栈与核心网/IMS绑定关系表")); builder.HasKey(binding => binding.Id); // 配置复合唯一索引:NetworkStackConfigId + Index diff --git a/src/X1.Infrastructure/Configurations/Permission/PermissionConfiguration.cs b/src/X1.Infrastructure/Configurations/Permission/PermissionConfiguration.cs index 6b0b7c2..fda6412 100644 --- a/src/X1.Infrastructure/Configurations/Permission/PermissionConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Permission/PermissionConfiguration.cs @@ -8,7 +8,7 @@ public class PermissionConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("Permissions"); + builder.ToTable("tb_permissions"); builder.HasKey(p => p.Id); builder.Property(p => p.Name).IsRequired().HasMaxLength(50); builder.Property(p => p.Description).HasMaxLength(200); diff --git a/src/X1.Infrastructure/Configurations/Permission/RolePermissionConfiguration.cs b/src/X1.Infrastructure/Configurations/Permission/RolePermissionConfiguration.cs index a86652e..a861899 100644 --- a/src/X1.Infrastructure/Configurations/Permission/RolePermissionConfiguration.cs +++ b/src/X1.Infrastructure/Configurations/Permission/RolePermissionConfiguration.cs @@ -8,7 +8,7 @@ public class RolePermissionConfiguration : IEntityTypeConfiguration builder) { - builder.ToTable("RolePermissions"); + builder.ToTable("tb_role_permissions"); builder.HasKey(rp => new { rp.RoleId, rp.PermissionId }); builder.Property(rp => rp.CreatedAt).IsRequired(); diff --git a/src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.Designer.cs b/src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.Designer.cs deleted file mode 100644 index c70a7f5..0000000 --- a/src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.Designer.cs +++ /dev/null @@ -1,929 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace X1.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250728081332_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true) - .HasComment("用户状态(true: 启用, false: 禁用)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasComment("是否已删除"); - - b.Property("LastLoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("最后登录时间"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("ModifiedTime") - .HasColumnType("timestamp with time zone") - .HasComment("修改时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化账号(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("RealName") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("用户名"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("账号"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("设备ID"); - - b.Property("AgentPort") - .HasColumnType("integer") - .HasComment("Agent端口"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("设备描述"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(45) - .HasColumnType("character varying(45)") - .HasComment("IP地址"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsEnabled") - .HasColumnType("boolean") - .HasComment("是否启用"); - - b.Property("IsRunning") - .HasColumnType("boolean") - .HasComment("设备状态(启动/未启动)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("设备名称"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("序列号"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("SerialNumber") - .IsUnique() - .HasDatabaseName("IX_CellularDevices_SerialNumber"); - - b.ToTable("CellularDevices", null, t => - { - t.HasComment("蜂窝设备表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("版本ID"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("版本描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsEnabled") - .HasColumnType("boolean") - .HasComment("是否启用"); - - b.Property("MinimumSupportedVersion") - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasComment("最低支持版本"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("版本名称"); - - b.Property("ReleaseDate") - .HasColumnType("timestamp with time zone") - .HasComment("发布日期"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("设备序列号"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasComment("版本号"); - - b.HasKey("Id"); - - b.HasIndex("SerialNumber") - .HasDatabaseName("IX_ProtocolVersions_SerialNumber"); - - b.HasIndex("Version") - .HasDatabaseName("IX_ProtocolVersions_Version"); - - b.ToTable("ProtocolVersions", null, t => - { - t.HasComment("协议版本表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("日志ID"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("浏览器信息"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FailureReason") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("失败原因"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("登录IP"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsSuccess") - .HasColumnType("boolean") - .HasComment("登录状态(成功/失败)"); - - b.Property("Location") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("登录位置"); - - b.Property("LoginSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("LoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("登录时间"); - - b.Property("LoginType") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("操作系统信息"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("设备信息"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("character varying(450)") - .HasComment("用户ID"); - - b.HasKey("Id"); - - b.HasIndex("IpAddress") - .HasDatabaseName("IX_LoginLogs_IpAddress"); - - b.HasIndex("LoginTime") - .HasDatabaseName("IX_LoginLogs_LoginTime"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_LoginLogs_UserId"); - - b.HasIndex("UserId", "LoginTime") - .HasDatabaseName("IX_LoginLogs_UserId_LoginTime"); - - b.ToTable("LoginLogs", null, t => - { - t.HasComment("用户登录日志表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.CoreNetworkConfig", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("ConfigContent") - .IsRequired() - .HasColumnType("text") - .HasComment("配置内容(JSON格式)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("配置描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsDisabled") - .HasColumnType("boolean") - .HasComment("是否禁用"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("配置名称"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .HasDatabaseName("IX_CoreNetworkConfigs_Name"); - - b.ToTable("CoreNetworkConfigs", null, t => - { - t.HasComment("核心网配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.IMS_Configuration", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("ConfigContent") - .IsRequired() - .HasColumnType("text") - .HasComment("配置内容(JSON格式)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("配置描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsDisabled") - .HasColumnType("boolean") - .HasComment("是否禁用"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("配置名称"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .HasDatabaseName("IX_IMS_Configurations_Name"); - - b.ToTable("IMS_Configurations", null, t => - { - t.HasComment("IMS配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("描述"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasComment("是否激活"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("RanId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("RAN配置ID"); - - b.Property("StackId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("栈ID"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_NetworkStackConfigs_IsActive"); - - b.HasIndex("RanId") - .HasDatabaseName("IX_NetworkStackConfigs_RanId"); - - b.HasIndex("StackId") - .IsUnique() - .HasDatabaseName("IX_NetworkStackConfigs_StackId"); - - b.ToTable("NetworkStackConfigs", null, t => - { - t.HasComment("网络栈配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.RAN_Configuration", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("ConfigContent") - .IsRequired() - .HasColumnType("text") - .HasComment("配置内容(JSON格式)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("配置描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsDisabled") - .HasColumnType("boolean") - .HasComment("是否禁用"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("配置名称"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .HasDatabaseName("IX_RAN_Configurations_Name"); - - b.ToTable("RAN_Configurations", null, t => - { - t.HasComment("RAN配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.Stack_CoreIMS_Binding", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("绑定关系ID"); - - b.Property("CnId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("核心网配置ID"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("ImsId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("IMS配置ID"); - - b.Property("Index") - .HasColumnType("integer") - .HasComment("索引"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("StackId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("栈ID"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CnId") - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_CnId"); - - b.HasIndex("ImsId") - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_ImsId"); - - b.HasIndex("StackId") - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_StackId"); - - b.HasIndex("StackId", "Index") - .IsUnique() - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_StackId_Index"); - - b.ToTable("Stack_CoreIMS_Bindings", null, t => - { - t.HasComment("栈与核心网/IMS绑定关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => - { - b.HasOne("CellularManagement.Domain.Entities.Device.CellularDevice", null) - .WithMany("ProtocolVersions") - .HasForeignKey("SerialNumber") - .HasPrincipalKey("SerialNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => - { - b.HasOne("CellularManagement.Domain.Entities.AppUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => - { - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.RAN_Configuration", null) - .WithMany() - .HasForeignKey("RanId") - .OnDelete(DeleteBehavior.SetNull); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.Stack_CoreIMS_Binding", b => - { - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.CoreNetworkConfig", "CoreNetworkConfig") - .WithMany() - .HasForeignKey("CnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.IMS_Configuration", "IMSConfiguration") - .WithMany() - .HasForeignKey("ImsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", "NetworkStackConfig") - .WithMany("StackCoreIMSBindings") - .HasForeignKey("StackId") - .HasPrincipalKey("StackId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CoreNetworkConfig"); - - b.Navigation("IMSConfiguration"); - - b.Navigation("NetworkStackConfig"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.HasOne("CellularManagement.Domain.Entities.Permission", "Permission") - .WithMany("RolePermissions") - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.AppRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.HasOne("CellularManagement.Domain.Entities.AppRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.AppUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => - { - b.Navigation("ProtocolVersions"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => - { - b.Navigation("StackCoreIMSBindings"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.Designer.cs b/src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.Designer.cs deleted file mode 100644 index dfe2219..0000000 --- a/src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.Designer.cs +++ /dev/null @@ -1,909 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace X1.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250728164913_UpdateNetworkStackConfigAndBindings")] - partial class UpdateNetworkStackConfigAndBindings - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true) - .HasComment("用户状态(true: 启用, false: 禁用)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasComment("是否已删除"); - - b.Property("LastLoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("最后登录时间"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("ModifiedTime") - .HasColumnType("timestamp with time zone") - .HasComment("修改时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化账号(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("RealName") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("用户名"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("账号"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("设备ID"); - - b.Property("AgentPort") - .HasColumnType("integer") - .HasComment("Agent端口"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("设备描述"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(45) - .HasColumnType("character varying(45)") - .HasComment("IP地址"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsEnabled") - .HasColumnType("boolean") - .HasComment("是否启用"); - - b.Property("IsRunning") - .HasColumnType("boolean") - .HasComment("设备状态(启动/未启动)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("设备名称"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("序列号"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("SerialNumber") - .IsUnique() - .HasDatabaseName("IX_CellularDevices_SerialNumber"); - - b.ToTable("CellularDevices", null, t => - { - t.HasComment("蜂窝设备表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("版本ID"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("版本描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsEnabled") - .HasColumnType("boolean") - .HasComment("是否启用"); - - b.Property("MinimumSupportedVersion") - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasComment("最低支持版本"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("版本名称"); - - b.Property("ReleaseDate") - .HasColumnType("timestamp with time zone") - .HasComment("发布日期"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("设备序列号"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasComment("版本号"); - - b.HasKey("Id"); - - b.HasIndex("SerialNumber") - .HasDatabaseName("IX_ProtocolVersions_SerialNumber"); - - b.HasIndex("Version") - .HasDatabaseName("IX_ProtocolVersions_Version"); - - b.ToTable("ProtocolVersions", null, t => - { - t.HasComment("协议版本表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("日志ID"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("浏览器信息"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FailureReason") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("失败原因"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("登录IP"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsSuccess") - .HasColumnType("boolean") - .HasComment("登录状态(成功/失败)"); - - b.Property("Location") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("登录位置"); - - b.Property("LoginSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("LoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("登录时间"); - - b.Property("LoginType") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("操作系统信息"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("设备信息"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("character varying(450)") - .HasComment("用户ID"); - - b.HasKey("Id"); - - b.HasIndex("IpAddress") - .HasDatabaseName("IX_LoginLogs_IpAddress"); - - b.HasIndex("LoginTime") - .HasDatabaseName("IX_LoginLogs_LoginTime"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_LoginLogs_UserId"); - - b.HasIndex("UserId", "LoginTime") - .HasDatabaseName("IX_LoginLogs_UserId_LoginTime"); - - b.ToTable("LoginLogs", null, t => - { - t.HasComment("用户登录日志表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.CoreNetworkConfig", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("ConfigContent") - .IsRequired() - .HasColumnType("text") - .HasComment("配置内容(JSON格式)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("配置描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsDisabled") - .HasColumnType("boolean") - .HasComment("是否禁用"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("配置名称"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .HasDatabaseName("IX_CoreNetworkConfigs_Name"); - - b.ToTable("CoreNetworkConfigs", null, t => - { - t.HasComment("核心网配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.IMS_Configuration", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("ConfigContent") - .IsRequired() - .HasColumnType("text") - .HasComment("配置内容(JSON格式)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("配置描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsDisabled") - .HasColumnType("boolean") - .HasComment("是否禁用"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("配置名称"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .HasDatabaseName("IX_IMS_Configurations_Name"); - - b.ToTable("IMS_Configurations", null, t => - { - t.HasComment("IMS配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("描述"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasComment("是否激活"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("NetworkStackName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("网络栈名称"); - - b.Property("RanId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("RAN配置ID"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_NetworkStackConfigs_IsActive"); - - b.HasIndex("NetworkStackName") - .IsUnique() - .HasDatabaseName("IX_NetworkStackConfigs_NetworkStackName"); - - b.HasIndex("RanId") - .HasDatabaseName("IX_NetworkStackConfigs_RanId"); - - b.ToTable("NetworkStackConfigs", null, t => - { - t.HasComment("网络栈配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.RAN_Configuration", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("ConfigContent") - .IsRequired() - .HasColumnType("text") - .HasComment("配置内容(JSON格式)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("配置描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsDisabled") - .HasColumnType("boolean") - .HasComment("是否禁用"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("配置名称"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .HasDatabaseName("IX_RAN_Configurations_Name"); - - b.ToTable("RAN_Configurations", null, t => - { - t.HasComment("RAN配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.Stack_CoreIMS_Binding", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("绑定关系ID"); - - b.Property("CnId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("核心网配置ID"); - - b.Property("ImsId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("IMS配置ID"); - - b.Property("Index") - .HasColumnType("integer") - .HasComment("索引"); - - b.Property("NetworkStackConfigId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("网络栈配置ID"); - - b.HasKey("Id"); - - b.HasIndex("CnId") - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_CnId"); - - b.HasIndex("ImsId") - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_ImsId"); - - b.HasIndex("NetworkStackConfigId") - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_NetworkStackConfigId"); - - b.HasIndex("NetworkStackConfigId", "Index") - .IsUnique() - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_NetworkStackConfigId_Index"); - - b.ToTable("Stack_CoreIMS_Bindings", null, t => - { - t.HasComment("栈与核心网/IMS绑定关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => - { - b.HasOne("CellularManagement.Domain.Entities.Device.CellularDevice", null) - .WithMany("ProtocolVersions") - .HasForeignKey("SerialNumber") - .HasPrincipalKey("SerialNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => - { - b.HasOne("CellularManagement.Domain.Entities.AppUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => - { - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.RAN_Configuration", null) - .WithMany() - .HasForeignKey("RanId") - .OnDelete(DeleteBehavior.SetNull); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.Stack_CoreIMS_Binding", b => - { - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.CoreNetworkConfig", "CoreNetworkConfig") - .WithMany() - .HasForeignKey("CnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.IMS_Configuration", "IMSConfiguration") - .WithMany() - .HasForeignKey("ImsId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", "NetworkStackConfig") - .WithMany("StackCoreIMSBindings") - .HasForeignKey("NetworkStackConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CoreNetworkConfig"); - - b.Navigation("IMSConfiguration"); - - b.Navigation("NetworkStackConfig"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.HasOne("CellularManagement.Domain.Entities.Permission", "Permission") - .WithMany("RolePermissions") - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.AppRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.HasOne("CellularManagement.Domain.Entities.AppRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.AppUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => - { - b.Navigation("ProtocolVersions"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => - { - b.Navigation("StackCoreIMSBindings"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.cs b/src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.cs deleted file mode 100644 index 2c3194c..0000000 --- a/src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.cs +++ /dev/null @@ -1,266 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace X1.Infrastructure.Migrations -{ - /// - public partial class UpdateNetworkStackConfigAndBindings : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Stack_CoreIMS_Bindings_CoreNetworkConfigs_CnId", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropForeignKey( - name: "FK_Stack_CoreIMS_Bindings_IMS_Configurations_ImsId", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropForeignKey( - name: "FK_Stack_CoreIMS_Bindings_NetworkStackConfigs_StackId", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropIndex( - name: "IX_Stack_CoreIMS_Bindings_StackId", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropIndex( - name: "IX_Stack_CoreIMS_Bindings_StackId_Index", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropUniqueConstraint( - name: "AK_NetworkStackConfigs_StackId", - table: "NetworkStackConfigs"); - - migrationBuilder.DropIndex( - name: "IX_NetworkStackConfigs_StackId", - table: "NetworkStackConfigs"); - - migrationBuilder.DropColumn( - name: "CreatedAt", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropColumn( - name: "CreatedBy", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropColumn( - name: "IsDeleted", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropColumn( - name: "StackId", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropColumn( - name: "UpdatedAt", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropColumn( - name: "UpdatedBy", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropColumn( - name: "StackId", - table: "NetworkStackConfigs"); - - migrationBuilder.AddColumn( - name: "NetworkStackConfigId", - table: "Stack_CoreIMS_Bindings", - type: "character varying(50)", - maxLength: 50, - nullable: false, - defaultValue: "", - comment: "网络栈配置ID"); - - migrationBuilder.AddColumn( - name: "NetworkStackName", - table: "NetworkStackConfigs", - type: "character varying(100)", - maxLength: 100, - nullable: false, - defaultValue: "", - comment: "网络栈名称"); - - migrationBuilder.CreateIndex( - name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId", - table: "Stack_CoreIMS_Bindings", - column: "NetworkStackConfigId"); - - migrationBuilder.CreateIndex( - name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId_Index", - table: "Stack_CoreIMS_Bindings", - columns: new[] { "NetworkStackConfigId", "Index" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_NetworkStackConfigs_NetworkStackName", - table: "NetworkStackConfigs", - column: "NetworkStackName", - unique: true); - - migrationBuilder.AddForeignKey( - name: "FK_Stack_CoreIMS_Bindings_CoreNetworkConfigs_CnId", - table: "Stack_CoreIMS_Bindings", - column: "CnId", - principalTable: "CoreNetworkConfigs", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Stack_CoreIMS_Bindings_IMS_Configurations_ImsId", - table: "Stack_CoreIMS_Bindings", - column: "ImsId", - principalTable: "IMS_Configurations", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Stack_CoreIMS_Bindings_NetworkStackConfigs_NetworkStackConf~", - table: "Stack_CoreIMS_Bindings", - column: "NetworkStackConfigId", - principalTable: "NetworkStackConfigs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Stack_CoreIMS_Bindings_CoreNetworkConfigs_CnId", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropForeignKey( - name: "FK_Stack_CoreIMS_Bindings_IMS_Configurations_ImsId", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropForeignKey( - name: "FK_Stack_CoreIMS_Bindings_NetworkStackConfigs_NetworkStackConf~", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropIndex( - name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropIndex( - name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId_Index", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropIndex( - name: "IX_NetworkStackConfigs_NetworkStackName", - table: "NetworkStackConfigs"); - - migrationBuilder.DropColumn( - name: "NetworkStackConfigId", - table: "Stack_CoreIMS_Bindings"); - - migrationBuilder.DropColumn( - name: "NetworkStackName", - table: "NetworkStackConfigs"); - - migrationBuilder.AddColumn( - name: "CreatedAt", - table: "Stack_CoreIMS_Bindings", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - comment: "创建时间"); - - migrationBuilder.AddColumn( - name: "CreatedBy", - table: "Stack_CoreIMS_Bindings", - type: "text", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "IsDeleted", - table: "Stack_CoreIMS_Bindings", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "StackId", - table: "Stack_CoreIMS_Bindings", - type: "character varying(50)", - maxLength: 50, - nullable: false, - defaultValue: "", - comment: "栈ID"); - - migrationBuilder.AddColumn( - name: "UpdatedAt", - table: "Stack_CoreIMS_Bindings", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - comment: "更新时间"); - - migrationBuilder.AddColumn( - name: "UpdatedBy", - table: "Stack_CoreIMS_Bindings", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "StackId", - table: "NetworkStackConfigs", - type: "character varying(50)", - maxLength: 50, - nullable: false, - defaultValue: "", - comment: "栈ID"); - - migrationBuilder.AddUniqueConstraint( - name: "AK_NetworkStackConfigs_StackId", - table: "NetworkStackConfigs", - column: "StackId"); - - migrationBuilder.CreateIndex( - name: "IX_Stack_CoreIMS_Bindings_StackId", - table: "Stack_CoreIMS_Bindings", - column: "StackId"); - - migrationBuilder.CreateIndex( - name: "IX_Stack_CoreIMS_Bindings_StackId_Index", - table: "Stack_CoreIMS_Bindings", - columns: new[] { "StackId", "Index" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_NetworkStackConfigs_StackId", - table: "NetworkStackConfigs", - column: "StackId", - unique: true); - - migrationBuilder.AddForeignKey( - name: "FK_Stack_CoreIMS_Bindings_CoreNetworkConfigs_CnId", - table: "Stack_CoreIMS_Bindings", - column: "CnId", - principalTable: "CoreNetworkConfigs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_Stack_CoreIMS_Bindings_IMS_Configurations_ImsId", - table: "Stack_CoreIMS_Bindings", - column: "ImsId", - principalTable: "IMS_Configurations", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_Stack_CoreIMS_Bindings_NetworkStackConfigs_StackId", - table: "Stack_CoreIMS_Bindings", - column: "StackId", - principalTable: "NetworkStackConfigs", - principalColumn: "StackId", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.Designer.cs b/src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.Designer.cs deleted file mode 100644 index 7276751..0000000 --- a/src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.Designer.cs +++ /dev/null @@ -1,923 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace X1.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250729142128_AddNetworkCodeToNetworkStackConfig")] - partial class AddNetworkCodeToNetworkStackConfig - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true) - .HasComment("用户状态(true: 启用, false: 禁用)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasComment("是否已删除"); - - b.Property("LastLoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("最后登录时间"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("ModifiedTime") - .HasColumnType("timestamp with time zone") - .HasComment("修改时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化账号(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("RealName") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("用户名"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("账号"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("设备ID"); - - b.Property("AgentPort") - .HasColumnType("integer") - .HasComment("Agent端口"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("设备描述"); - - b.Property("DeviceCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("设备编码"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(45) - .HasColumnType("character varying(45)") - .HasComment("IP地址"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsEnabled") - .HasColumnType("boolean") - .HasComment("是否启用"); - - b.Property("IsRunning") - .HasColumnType("boolean") - .HasComment("设备状态(启动/未启动)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("设备名称"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("序列号"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeviceCode") - .IsUnique() - .HasDatabaseName("IX_CellularDevices_DeviceCode"); - - b.HasIndex("SerialNumber") - .IsUnique() - .HasDatabaseName("IX_CellularDevices_SerialNumber"); - - b.ToTable("CellularDevices", null, t => - { - t.HasComment("蜂窝设备表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("版本ID"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("版本描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsEnabled") - .HasColumnType("boolean") - .HasComment("是否启用"); - - b.Property("MinimumSupportedVersion") - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasComment("最低支持版本"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("版本名称"); - - b.Property("ReleaseDate") - .HasColumnType("timestamp with time zone") - .HasComment("发布日期"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("设备序列号"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.Property("Version") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasComment("版本号"); - - b.HasKey("Id"); - - b.HasIndex("SerialNumber") - .HasDatabaseName("IX_ProtocolVersions_SerialNumber"); - - b.HasIndex("Version") - .HasDatabaseName("IX_ProtocolVersions_Version"); - - b.ToTable("ProtocolVersions", null, t => - { - t.HasComment("协议版本表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("日志ID"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("浏览器信息"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("FailureReason") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("失败原因"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("登录IP"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsSuccess") - .HasColumnType("boolean") - .HasComment("登录状态(成功/失败)"); - - b.Property("Location") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("登录位置"); - - b.Property("LoginSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("LoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("登录时间"); - - b.Property("LoginType") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("操作系统信息"); - - b.Property("SessionId") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("设备信息"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("character varying(450)") - .HasComment("用户ID"); - - b.HasKey("Id"); - - b.HasIndex("IpAddress") - .HasDatabaseName("IX_LoginLogs_IpAddress"); - - b.HasIndex("LoginTime") - .HasDatabaseName("IX_LoginLogs_LoginTime"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_LoginLogs_UserId"); - - b.HasIndex("UserId", "LoginTime") - .HasDatabaseName("IX_LoginLogs_UserId_LoginTime"); - - b.ToTable("LoginLogs", null, t => - { - t.HasComment("用户登录日志表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.CoreNetworkConfig", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("ConfigContent") - .IsRequired() - .HasColumnType("text") - .HasComment("配置内容(JSON格式)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("配置描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsDisabled") - .HasColumnType("boolean") - .HasComment("是否禁用"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("配置名称"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .HasDatabaseName("IX_CoreNetworkConfigs_Name"); - - b.ToTable("CoreNetworkConfigs", null, t => - { - t.HasComment("核心网配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.IMS_Configuration", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("ConfigContent") - .IsRequired() - .HasColumnType("text") - .HasComment("配置内容(JSON格式)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("配置描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsDisabled") - .HasColumnType("boolean") - .HasComment("是否禁用"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("配置名称"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .HasDatabaseName("IX_IMS_Configurations_Name"); - - b.ToTable("IMS_Configurations", null, t => - { - t.HasComment("IMS配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("描述"); - - b.Property("IsActive") - .HasColumnType("boolean") - .HasComment("是否激活"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("NetworkCode") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("NetworkStackName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("网络栈名称"); - - b.Property("RanId") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("RAN配置ID"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_NetworkStackConfigs_IsActive"); - - b.HasIndex("NetworkStackName") - .IsUnique() - .HasDatabaseName("IX_NetworkStackConfigs_NetworkStackName"); - - b.HasIndex("RanId") - .HasDatabaseName("IX_NetworkStackConfigs_RanId"); - - b.ToTable("NetworkStackConfigs", null, t => - { - t.HasComment("网络栈配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.RAN_Configuration", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("配置ID"); - - b.Property("ConfigContent") - .IsRequired() - .HasColumnType("text") - .HasComment("配置内容(JSON格式)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("配置描述"); - - b.Property("IsDeleted") - .HasColumnType("boolean"); - - b.Property("IsDisabled") - .HasColumnType("boolean") - .HasComment("是否禁用"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("配置名称"); - - b.Property("UpdatedAt") - .IsRequired() - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.Property("UpdatedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .HasDatabaseName("IX_RAN_Configurations_Name"); - - b.ToTable("RAN_Configurations", null, t => - { - t.HasComment("RAN配置表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.Stack_CoreIMS_Binding", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("绑定关系ID"); - - b.Property("CnId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("核心网配置ID"); - - b.Property("ImsId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("IMS配置ID"); - - b.Property("Index") - .HasColumnType("integer") - .HasComment("索引"); - - b.Property("NetworkStackConfigId") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("网络栈配置ID"); - - b.HasKey("Id"); - - b.HasIndex("CnId") - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_CnId"); - - b.HasIndex("ImsId") - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_ImsId"); - - b.HasIndex("NetworkStackConfigId") - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_NetworkStackConfigId"); - - b.HasIndex("NetworkStackConfigId", "Index") - .IsUnique() - .HasDatabaseName("IX_Stack_CoreIMS_Bindings_NetworkStackConfigId_Index"); - - b.ToTable("Stack_CoreIMS_Bindings", null, t => - { - t.HasComment("栈与核心网/IMS绑定关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => - { - b.HasOne("CellularManagement.Domain.Entities.Device.CellularDevice", null) - .WithMany("ProtocolVersions") - .HasForeignKey("SerialNumber") - .HasPrincipalKey("SerialNumber") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => - { - b.HasOne("CellularManagement.Domain.Entities.AppUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => - { - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.RAN_Configuration", null) - .WithMany() - .HasForeignKey("RanId") - .OnDelete(DeleteBehavior.SetNull); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.Stack_CoreIMS_Binding", b => - { - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.CoreNetworkConfig", "CoreNetworkConfig") - .WithMany() - .HasForeignKey("CnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.IMS_Configuration", "IMSConfiguration") - .WithMany() - .HasForeignKey("ImsId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", "NetworkStackConfig") - .WithMany("StackCoreIMSBindings") - .HasForeignKey("NetworkStackConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CoreNetworkConfig"); - - b.Navigation("IMSConfiguration"); - - b.Navigation("NetworkStackConfig"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.HasOne("CellularManagement.Domain.Entities.Permission", "Permission") - .WithMany("RolePermissions") - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.AppRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.HasOne("CellularManagement.Domain.Entities.AppRole", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("CellularManagement.Domain.Entities.AppUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => - { - b.Navigation("ProtocolVersions"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => - { - b.Navigation("StackCoreIMSBindings"); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.cs b/src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.cs deleted file mode 100644 index a980d65..0000000 --- a/src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace X1.Infrastructure.Migrations -{ - /// - public partial class AddNetworkCodeToNetworkStackConfig : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "NetworkCode", - table: "NetworkStackConfigs", - type: "character varying(50)", - maxLength: 50, - nullable: true); - - migrationBuilder.AddColumn( - name: "DeviceCode", - table: "CellularDevices", - type: "character varying(50)", - maxLength: 50, - nullable: false, - defaultValue: "", - comment: "设备编码"); - - migrationBuilder.CreateIndex( - name: "IX_CellularDevices_DeviceCode", - table: "CellularDevices", - column: "DeviceCode", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_CellularDevices_DeviceCode", - table: "CellularDevices"); - - migrationBuilder.DropColumn( - name: "NetworkCode", - table: "NetworkStackConfigs"); - - migrationBuilder.DropColumn( - name: "DeviceCode", - table: "CellularDevices"); - } - } -} diff --git a/src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.cs b/src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.cs deleted file mode 100644 index 89ac020..0000000 --- a/src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.cs +++ /dev/null @@ -1,76 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace X1.Infrastructure.Migrations -{ - /// - public partial class AddNetworkStackCode : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "NetworkCode", - table: "NetworkStackConfigs"); - - migrationBuilder.AddColumn( - name: "NetworkStackCode", - table: "NetworkStackConfigs", - type: "character varying(50)", - maxLength: 50, - nullable: true, - comment: "网络栈编码"); - - // 为现有数据生成编码 - migrationBuilder.Sql(@" - WITH numbered_configs AS ( - SELECT - ""Id"", - ROW_NUMBER() OVER (ORDER BY ""CreatedAt"") as row_num, - to_char(""CreatedAt"", 'YYYYMMDD-HH24MISS-MS') as time_stamp - FROM ""NetworkStackConfigs"" - WHERE ""NetworkStackCode"" IS NULL - ) - UPDATE ""NetworkStackConfigs"" - SET ""NetworkStackCode"" = 'NSC-' || nc.time_stamp || '-' || LPAD(nc.row_num::text, 3, '0') - FROM numbered_configs nc - WHERE ""NetworkStackConfigs"".""Id"" = nc.""Id""; - "); - - // 设置字段为非空 - migrationBuilder.AlterColumn( - name: "NetworkStackCode", - table: "NetworkStackConfigs", - type: "character varying(50)", - maxLength: 50, - nullable: false, - comment: "网络栈编码"); - - migrationBuilder.CreateIndex( - name: "IX_NetworkStackConfigs_NetworkStackCode", - table: "NetworkStackConfigs", - column: "NetworkStackCode", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_NetworkStackConfigs_NetworkStackCode", - table: "NetworkStackConfigs"); - - migrationBuilder.DropColumn( - name: "NetworkStackCode", - table: "NetworkStackConfigs"); - - migrationBuilder.AddColumn( - name: "NetworkCode", - table: "NetworkStackConfigs", - type: "character varying(50)", - maxLength: 50, - nullable: true); - } - } -} diff --git a/src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.Designer.cs b/src/X1.Infrastructure/Migrations/20250801075432_InitialCreate.Designer.cs similarity index 78% rename from src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.Designer.cs rename to src/X1.Infrastructure/Migrations/20250801075432_InitialCreate.Designer.cs index f43f6bb..dc4301f 100644 --- a/src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.Designer.cs +++ b/src/X1.Infrastructure/Migrations/20250801075432_InitialCreate.Designer.cs @@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace X1.Infrastructure.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20250729144236_AddNetworkStackCode")] - partial class AddNetworkStackCode + [Migration("20250801075432_InitialCreate")] + partial class InitialCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -71,7 +71,7 @@ namespace X1.Infrastructure.Migrations .IsUnique() .HasDatabaseName("RoleNameIndex"); - b.ToTable("Roles", null, t => + b.ToTable("tb_roles", null, t => { t.HasComment("角色表"); }); @@ -180,7 +180,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Email") .IsUnique() - .HasDatabaseName("IX_Users_Email"); + .HasDatabaseName("IX_user_Email"); b.HasIndex("NormalizedEmail") .HasDatabaseName("EmailIndex"); @@ -191,13 +191,13 @@ namespace X1.Infrastructure.Migrations b.HasIndex("PhoneNumber") .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); + .HasDatabaseName("IX_user_PhoneNumber"); b.HasIndex("UserName") .IsUnique() - .HasDatabaseName("IX_Users_UserName"); + .HasDatabaseName("IX_user_UserName"); - b.ToTable("Users", null, t => + b.ToTable("tb_users", null, t => { t.HasComment("用户表"); }); @@ -246,10 +246,6 @@ namespace X1.Infrastructure.Migrations .HasColumnType("boolean") .HasComment("是否启用"); - b.Property("IsRunning") - .HasColumnType("boolean") - .HasComment("设备状态(启动/未启动)"); - b.Property("Name") .IsRequired() .HasMaxLength(100) @@ -274,18 +270,121 @@ namespace X1.Infrastructure.Migrations b.HasIndex("DeviceCode") .IsUnique() - .HasDatabaseName("IX_CellularDevices_DeviceCode"); + .HasDatabaseName("IX_cellular_device_DeviceCode"); b.HasIndex("SerialNumber") .IsUnique() - .HasDatabaseName("IX_CellularDevices_SerialNumber"); + .HasDatabaseName("IX_cellular_device_SerialNumber"); - b.ToTable("CellularDevices", null, t => + b.ToTable("tb_cellular_device", null, t => { t.HasComment("蜂窝设备表"); }); }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDeviceRuntime", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.Property("NetworkStackCode") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("RuntimeCode") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("RuntimeStatus") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("IsDeleted"); + + b.HasIndex("NetworkStackCode"); + + b.HasIndex("RuntimeCode"); + + b.HasIndex("RuntimeStatus"); + + b.HasIndex("DeviceCode", "CreatedAt") + .HasDatabaseName("IX_CellularDeviceRuntimes_DeviceCode_CreatedAt"); + + b.ToTable("tb_cellular_device_runtimes", (string)null); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDeviceRuntimeDetail", b => + { + b.Property("Id") + .HasMaxLength(450) + .HasColumnType("character varying(450)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedBy") + .HasMaxLength(450) + .HasColumnType("character varying(450)"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("NetworkStackCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("RuntimeCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("RuntimeStatus") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.HasKey("Id"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_CellularDeviceRuntimeDetails_CreatedAt"); + + b.HasIndex("CreatedBy") + .HasDatabaseName("IX_CellularDeviceRuntimeDetails_CreatedBy"); + + b.HasIndex("RuntimeCode") + .HasDatabaseName("IX_CellularDeviceRuntimeDetails_RuntimeCode"); + + b.HasIndex("RuntimeStatus") + .HasDatabaseName("IX_CellularDeviceRuntimeDetails_RuntimeStatus"); + + b.ToTable("tb_cellular_device_runtime_details", (string)null); + }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => { b.Property("Id") @@ -355,7 +454,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Version") .HasDatabaseName("IX_ProtocolVersions_Version"); - b.ToTable("ProtocolVersions", null, t => + b.ToTable("tb_protocol_versions", null, t => { t.HasComment("协议版本表"); }); @@ -450,12 +549,112 @@ namespace X1.Infrastructure.Migrations b.HasIndex("UserId", "LoginTime") .HasDatabaseName("IX_LoginLogs_UserId_LoginTime"); - b.ToTable("LoginLogs", null, t => + b.ToTable("tb_login_logs", null, t => { t.HasComment("用户登录日志表"); }); }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.ProtocolLog", b => + { + b.Property("Id") + .HasColumnType("text") + .HasComment("主键ID"); + + b.Property("CellID") + .HasColumnType("integer") + .HasComment("小区ID"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("设备代码"); + + b.Property("Direction") + .HasColumnType("integer") + .HasComment("日志方向类型"); + + b.Property("IMSI") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("国际移动用户识别码"); + + b.Property("Info") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasComment("信息字段"); + + b.Property("LayerType") + .HasMaxLength(50) + .HasColumnType("integer") + .HasComment("协议层类型"); + + b.Property("Message") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)") + .HasComment("消息字段"); + + b.Property("MessageDetailJson") + .HasColumnType("text") + .HasComment("消息详情集合(JSON格式存储)"); + + b.Property("MessageId") + .HasColumnType("bigint") + .HasComment("消息ID"); + + b.Property("PLMN") + .HasMaxLength(20) + .HasColumnType("character varying(20)") + .HasComment("公共陆地移动网络标识"); + + b.Property("RuntimeCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("运行时代码"); + + b.Property("TimeMs") + .HasColumnType("bigint") + .HasComment("时间间隔(毫秒)"); + + b.Property("Timestamp") + .HasColumnType("bigint") + .HasComment("时间戳"); + + b.Property("UEID") + .HasColumnType("integer") + .HasComment("用户设备ID"); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .HasDatabaseName("IX_ProtocolLog_DeviceCode"); + + b.HasIndex("LayerType") + .HasDatabaseName("IX_ProtocolLog_LayerType"); + + b.HasIndex("MessageId") + .HasDatabaseName("IX_ProtocolLog_MessageId"); + + b.HasIndex("RuntimeCode") + .HasDatabaseName("IX_ProtocolLog_RuntimeCode"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_ProtocolLog_Timestamp"); + + b.HasIndex("DeviceCode", "RuntimeCode") + .HasDatabaseName("IX_ProtocolLog_DeviceCode_RuntimeCode"); + + b.HasIndex("DeviceCode", "Timestamp") + .HasDatabaseName("IX_ProtocolLog_DeviceCode_Timestamp"); + + b.ToTable("tb_protocol_logs", null, t => + { + t.HasComment("协议日志表"); + }); + }); + modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.CoreNetworkConfig", b => { b.Property("Id") @@ -507,7 +706,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Name") .HasDatabaseName("IX_CoreNetworkConfigs_Name"); - b.ToTable("CoreNetworkConfigs", null, t => + b.ToTable("tb_core_network_configs", null, t => { t.HasComment("核心网配置表"); }); @@ -564,7 +763,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Name") .HasDatabaseName("IX_IMS_Configurations_Name"); - b.ToTable("IMS_Configurations", null, t => + b.ToTable("tb_ims_configurations", null, t => { t.HasComment("IMS配置表"); }); @@ -637,7 +836,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("RanId") .HasDatabaseName("IX_NetworkStackConfigs_RanId"); - b.ToTable("NetworkStackConfigs", null, t => + b.ToTable("tb_network_stack_configs", null, t => { t.HasComment("网络栈配置表"); }); @@ -694,7 +893,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Name") .HasDatabaseName("IX_RAN_Configurations_Name"); - b.ToTable("RAN_Configurations", null, t => + b.ToTable("tb_ran_configurations", null, t => { t.HasComment("RAN配置表"); }); @@ -743,7 +942,7 @@ namespace X1.Infrastructure.Migrations .IsUnique() .HasDatabaseName("IX_Stack_CoreIMS_Bindings_NetworkStackConfigId_Index"); - b.ToTable("Stack_CoreIMS_Bindings", null, t => + b.ToTable("tb_stack_core_ims_bindings", null, t => { t.HasComment("栈与核心网/IMS绑定关系表"); }); @@ -778,7 +977,7 @@ namespace X1.Infrastructure.Migrations b.HasKey("Id"); - b.ToTable("Permissions", (string)null); + b.ToTable("tb_permissions", (string)null); }); modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => @@ -796,7 +995,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("PermissionId"); - b.ToTable("RolePermissions", (string)null); + b.ToTable("tb_role_permissions", (string)null); }); modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => @@ -811,12 +1010,24 @@ namespace X1.Infrastructure.Migrations b.HasIndex("RoleId"); - b.ToTable("UserRoles", null, t => + b.ToTable("tb_user_roles", null, t => { t.HasComment("用户角色关系表"); }); }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDeviceRuntime", b => + { + b.HasOne("CellularManagement.Domain.Entities.Device.CellularDevice", "Device") + .WithOne("Runtime") + .HasForeignKey("CellularManagement.Domain.Entities.Device.CellularDeviceRuntime", "DeviceCode") + .HasPrincipalKey("CellularManagement.Domain.Entities.Device.CellularDevice", "DeviceCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Device"); + }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => { b.HasOne("CellularManagement.Domain.Entities.Device.CellularDevice", null) @@ -912,6 +1123,8 @@ namespace X1.Infrastructure.Migrations modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => { b.Navigation("ProtocolVersions"); + + b.Navigation("Runtime"); }); modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => diff --git a/src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.cs b/src/X1.Infrastructure/Migrations/20250801075432_InitialCreate.cs similarity index 61% rename from src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.cs rename to src/X1.Infrastructure/Migrations/20250801075432_InitialCreate.cs index 1bea19a..da4eacd 100644 --- a/src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.cs +++ b/src/X1.Infrastructure/Migrations/20250801075432_InitialCreate.cs @@ -12,17 +12,17 @@ namespace X1.Infrastructure.Migrations protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( - name: "CellularDevices", + name: "tb_cellular_device", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "设备ID"), Name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false, comment: "设备名称"), SerialNumber = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "序列号"), + DeviceCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "设备编码"), Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: false, comment: "设备描述"), AgentPort = table.Column(type: "integer", nullable: false, comment: "Agent端口"), IpAddress = table.Column(type: "character varying(45)", maxLength: 45, nullable: false, comment: "IP地址"), IsEnabled = table.Column(type: "boolean", nullable: false, comment: "是否启用"), - IsRunning = table.Column(type: "boolean", nullable: false, comment: "设备状态(启动/未启动)"), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间"), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "更新时间"), IsDeleted = table.Column(type: "boolean", nullable: false), @@ -31,13 +31,31 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_CellularDevices", x => x.Id); - table.UniqueConstraint("AK_CellularDevices_SerialNumber", x => x.SerialNumber); + table.PrimaryKey("PK_tb_cellular_device", x => x.Id); + table.UniqueConstraint("AK_tb_cellular_device_DeviceCode", x => x.DeviceCode); + table.UniqueConstraint("AK_tb_cellular_device_SerialNumber", x => x.SerialNumber); }, comment: "蜂窝设备表"); migrationBuilder.CreateTable( - name: "CoreNetworkConfigs", + name: "tb_cellular_device_runtime_details", + columns: table => new + { + Id = table.Column(type: "character varying(450)", maxLength: 450, nullable: false), + DeviceCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + RuntimeCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + NetworkStackCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + RuntimeStatus = table.Column(type: "boolean", nullable: false, defaultValue: false), + CreatedBy = table.Column(type: "character varying(450)", maxLength: 450, nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_tb_cellular_device_runtime_details", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "tb_core_network_configs", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "配置ID"), @@ -53,12 +71,12 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_CoreNetworkConfigs", x => x.Id); + table.PrimaryKey("PK_tb_core_network_configs", x => x.Id); }, comment: "核心网配置表"); migrationBuilder.CreateTable( - name: "IMS_Configurations", + name: "tb_ims_configurations", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "配置ID"), @@ -74,12 +92,12 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_IMS_Configurations", x => x.Id); + table.PrimaryKey("PK_tb_ims_configurations", x => x.Id); }, comment: "IMS配置表"); migrationBuilder.CreateTable( - name: "Permissions", + name: "tb_permissions", columns: table => new { Id = table.Column(type: "text", nullable: false), @@ -91,11 +109,37 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_Permissions", x => x.Id); + table.PrimaryKey("PK_tb_permissions", x => x.Id); }); migrationBuilder.CreateTable( - name: "RAN_Configurations", + name: "tb_protocol_logs", + columns: table => new + { + Id = table.Column(type: "text", nullable: false, comment: "主键ID"), + MessageId = table.Column(type: "bigint", nullable: false, comment: "消息ID"), + LayerType = table.Column(type: "integer", maxLength: 50, nullable: false, comment: "协议层类型"), + MessageDetailJson = table.Column(type: "text", nullable: true, comment: "消息详情集合(JSON格式存储)"), + CellID = table.Column(type: "integer", nullable: true, comment: "小区ID"), + IMSI = table.Column(type: "character varying(50)", maxLength: 50, nullable: true, comment: "国际移动用户识别码"), + Direction = table.Column(type: "integer", nullable: false, comment: "日志方向类型"), + UEID = table.Column(type: "integer", nullable: true, comment: "用户设备ID"), + PLMN = table.Column(type: "character varying(20)", maxLength: 20, nullable: true, comment: "公共陆地移动网络标识"), + TimeMs = table.Column(type: "bigint", nullable: false, comment: "时间间隔(毫秒)"), + Timestamp = table.Column(type: "bigint", nullable: false, comment: "时间戳"), + Info = table.Column(type: "character varying(500)", maxLength: 500, nullable: true, comment: "信息字段"), + Message = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true, comment: "消息字段"), + DeviceCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "设备代码"), + RuntimeCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "运行时代码") + }, + constraints: table => + { + table.PrimaryKey("PK_tb_protocol_logs", x => x.Id); + }, + comment: "协议日志表"); + + migrationBuilder.CreateTable( + name: "tb_ran_configurations", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "配置ID"), @@ -111,12 +155,12 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_RAN_Configurations", x => x.Id); + table.PrimaryKey("PK_tb_ran_configurations", x => x.Id); }, comment: "RAN配置表"); migrationBuilder.CreateTable( - name: "Roles", + name: "tb_roles", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "角色ID,主键"), @@ -129,12 +173,12 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_Roles", x => x.Id); + table.PrimaryKey("PK_tb_roles", x => x.Id); }, comment: "角色表"); migrationBuilder.CreateTable( - name: "Users", + name: "tb_users", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "用户ID,主键"), @@ -161,12 +205,36 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_Users", x => x.Id); + table.PrimaryKey("PK_tb_users", x => x.Id); }, comment: "用户表"); migrationBuilder.CreateTable( - name: "ProtocolVersions", + name: "tb_cellular_device_runtimes", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + DeviceCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + RuntimeStatus = table.Column(type: "integer", nullable: false, defaultValue: 0), + RuntimeCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + NetworkStackCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false) + }, + constraints: table => + { + table.PrimaryKey("PK_tb_cellular_device_runtimes", x => x.Id); + table.ForeignKey( + name: "FK_tb_cellular_device_runtimes_tb_cellular_device_DeviceCode", + column: x => x.DeviceCode, + principalTable: "tb_cellular_device", + principalColumn: "DeviceCode", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "tb_protocol_versions", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "版本ID"), @@ -185,22 +253,23 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_ProtocolVersions", x => x.Id); + table.PrimaryKey("PK_tb_protocol_versions", x => x.Id); table.ForeignKey( - name: "FK_ProtocolVersions_CellularDevices_SerialNumber", + name: "FK_tb_protocol_versions_tb_cellular_device_SerialNumber", column: x => x.SerialNumber, - principalTable: "CellularDevices", + principalTable: "tb_cellular_device", principalColumn: "SerialNumber", onDelete: ReferentialAction.Cascade); }, comment: "协议版本表"); migrationBuilder.CreateTable( - name: "NetworkStackConfigs", + name: "tb_network_stack_configs", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "配置ID"), - StackId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "栈ID"), + NetworkStackName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false, comment: "网络栈名称"), + NetworkStackCode = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "网络栈编码"), RanId = table.Column(type: "character varying(50)", maxLength: 50, nullable: true, comment: "RAN配置ID"), Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true, comment: "描述"), IsActive = table.Column(type: "boolean", nullable: false, comment: "是否激活"), @@ -212,19 +281,18 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_NetworkStackConfigs", x => x.Id); - table.UniqueConstraint("AK_NetworkStackConfigs_StackId", x => x.StackId); + table.PrimaryKey("PK_tb_network_stack_configs", x => x.Id); table.ForeignKey( - name: "FK_NetworkStackConfigs_RAN_Configurations_RanId", + name: "FK_tb_network_stack_configs_tb_ran_configurations_RanId", column: x => x.RanId, - principalTable: "RAN_Configurations", + principalTable: "tb_ran_configurations", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }, comment: "网络栈配置表"); migrationBuilder.CreateTable( - name: "RolePermissions", + name: "tb_role_permissions", columns: table => new { RoleId = table.Column(type: "text", nullable: false), @@ -233,23 +301,23 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_RolePermissions", x => new { x.RoleId, x.PermissionId }); + table.PrimaryKey("PK_tb_role_permissions", x => new { x.RoleId, x.PermissionId }); table.ForeignKey( - name: "FK_RolePermissions_Permissions_PermissionId", + name: "FK_tb_role_permissions_tb_permissions_PermissionId", column: x => x.PermissionId, - principalTable: "Permissions", + principalTable: "tb_permissions", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_RolePermissions_Roles_RoleId", + name: "FK_tb_role_permissions_tb_roles_RoleId", column: x => x.RoleId, - principalTable: "Roles", + principalTable: "tb_roles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( - name: "LoginLogs", + name: "tb_login_logs", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "日志ID"), @@ -271,18 +339,18 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_LoginLogs", x => x.Id); + table.PrimaryKey("PK_tb_login_logs", x => x.Id); table.ForeignKey( - name: "FK_LoginLogs_Users_UserId", + name: "FK_tb_login_logs_tb_users_UserId", column: x => x.UserId, - principalTable: "Users", + principalTable: "tb_users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }, comment: "用户登录日志表"); migrationBuilder.CreateTable( - name: "UserRoles", + name: "tb_user_roles", columns: table => new { UserId = table.Column(type: "text", nullable: false), @@ -290,197 +358,290 @@ namespace X1.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId }); + table.PrimaryKey("PK_tb_user_roles", x => new { x.UserId, x.RoleId }); table.ForeignKey( - name: "FK_UserRoles_Roles_RoleId", + name: "FK_tb_user_roles_tb_roles_RoleId", column: x => x.RoleId, - principalTable: "Roles", + principalTable: "tb_roles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_UserRoles_Users_UserId", + name: "FK_tb_user_roles_tb_users_UserId", column: x => x.UserId, - principalTable: "Users", + principalTable: "tb_users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }, comment: "用户角色关系表"); migrationBuilder.CreateTable( - name: "Stack_CoreIMS_Bindings", + name: "tb_stack_core_ims_bindings", columns: table => new { Id = table.Column(type: "text", nullable: false, comment: "绑定关系ID"), - StackId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "栈ID"), + NetworkStackConfigId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "网络栈配置ID"), Index = table.Column(type: "integer", nullable: false, comment: "索引"), CnId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "核心网配置ID"), - ImsId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "IMS配置ID"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间"), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "更新时间"), - IsDeleted = table.Column(type: "boolean", nullable: false), - CreatedBy = table.Column(type: "text", nullable: false), - UpdatedBy = table.Column(type: "text", nullable: true) + ImsId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "IMS配置ID") }, constraints: table => { - table.PrimaryKey("PK_Stack_CoreIMS_Bindings", x => x.Id); + table.PrimaryKey("PK_tb_stack_core_ims_bindings", x => x.Id); table.ForeignKey( - name: "FK_Stack_CoreIMS_Bindings_CoreNetworkConfigs_CnId", + name: "FK_tb_stack_core_ims_bindings_tb_core_network_configs_CnId", column: x => x.CnId, - principalTable: "CoreNetworkConfigs", + principalTable: "tb_core_network_configs", principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_Stack_CoreIMS_Bindings_IMS_Configurations_ImsId", + name: "FK_tb_stack_core_ims_bindings_tb_ims_configurations_ImsId", column: x => x.ImsId, - principalTable: "IMS_Configurations", + principalTable: "tb_ims_configurations", principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_Stack_CoreIMS_Bindings_NetworkStackConfigs_StackId", - column: x => x.StackId, - principalTable: "NetworkStackConfigs", - principalColumn: "StackId", + name: "FK_tb_stack_core_ims_bindings_tb_network_stack_configs_Network~", + column: x => x.NetworkStackConfigId, + principalTable: "tb_network_stack_configs", + principalColumn: "Id", onDelete: ReferentialAction.Cascade); }, comment: "栈与核心网/IMS绑定关系表"); migrationBuilder.CreateIndex( - name: "IX_CellularDevices_SerialNumber", - table: "CellularDevices", + name: "IX_cellular_device_DeviceCode", + table: "tb_cellular_device", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_cellular_device_SerialNumber", + table: "tb_cellular_device", column: "SerialNumber", unique: true); + migrationBuilder.CreateIndex( + name: "IX_CellularDeviceRuntimeDetails_CreatedAt", + table: "tb_cellular_device_runtime_details", + column: "CreatedAt"); + + migrationBuilder.CreateIndex( + name: "IX_CellularDeviceRuntimeDetails_CreatedBy", + table: "tb_cellular_device_runtime_details", + column: "CreatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_CellularDeviceRuntimeDetails_RuntimeCode", + table: "tb_cellular_device_runtime_details", + column: "RuntimeCode"); + + migrationBuilder.CreateIndex( + name: "IX_CellularDeviceRuntimeDetails_RuntimeStatus", + table: "tb_cellular_device_runtime_details", + column: "RuntimeStatus"); + + migrationBuilder.CreateIndex( + name: "IX_CellularDeviceRuntimes_DeviceCode_CreatedAt", + table: "tb_cellular_device_runtimes", + columns: new[] { "DeviceCode", "CreatedAt" }); + + migrationBuilder.CreateIndex( + name: "IX_tb_cellular_device_runtimes_DeviceCode", + table: "tb_cellular_device_runtimes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_tb_cellular_device_runtimes_IsDeleted", + table: "tb_cellular_device_runtimes", + column: "IsDeleted"); + + migrationBuilder.CreateIndex( + name: "IX_tb_cellular_device_runtimes_NetworkStackCode", + table: "tb_cellular_device_runtimes", + column: "NetworkStackCode"); + + migrationBuilder.CreateIndex( + name: "IX_tb_cellular_device_runtimes_RuntimeCode", + table: "tb_cellular_device_runtimes", + column: "RuntimeCode"); + + migrationBuilder.CreateIndex( + name: "IX_tb_cellular_device_runtimes_RuntimeStatus", + table: "tb_cellular_device_runtimes", + column: "RuntimeStatus"); + migrationBuilder.CreateIndex( name: "IX_CoreNetworkConfigs_Name", - table: "CoreNetworkConfigs", + table: "tb_core_network_configs", column: "Name"); migrationBuilder.CreateIndex( name: "IX_IMS_Configurations_Name", - table: "IMS_Configurations", + table: "tb_ims_configurations", column: "Name"); migrationBuilder.CreateIndex( name: "IX_LoginLogs_IpAddress", - table: "LoginLogs", + table: "tb_login_logs", column: "IpAddress"); migrationBuilder.CreateIndex( name: "IX_LoginLogs_LoginTime", - table: "LoginLogs", + table: "tb_login_logs", column: "LoginTime"); migrationBuilder.CreateIndex( name: "IX_LoginLogs_UserId", - table: "LoginLogs", + table: "tb_login_logs", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_LoginLogs_UserId_LoginTime", - table: "LoginLogs", + table: "tb_login_logs", columns: new[] { "UserId", "LoginTime" }); migrationBuilder.CreateIndex( name: "IX_NetworkStackConfigs_IsActive", - table: "NetworkStackConfigs", + table: "tb_network_stack_configs", column: "IsActive"); + migrationBuilder.CreateIndex( + name: "IX_NetworkStackConfigs_NetworkStackCode", + table: "tb_network_stack_configs", + column: "NetworkStackCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_NetworkStackConfigs_NetworkStackName", + table: "tb_network_stack_configs", + column: "NetworkStackName", + unique: true); + migrationBuilder.CreateIndex( name: "IX_NetworkStackConfigs_RanId", - table: "NetworkStackConfigs", + table: "tb_network_stack_configs", column: "RanId"); migrationBuilder.CreateIndex( - name: "IX_NetworkStackConfigs_StackId", - table: "NetworkStackConfigs", - column: "StackId", - unique: true); + name: "IX_ProtocolLog_DeviceCode", + table: "tb_protocol_logs", + column: "DeviceCode"); + + migrationBuilder.CreateIndex( + name: "IX_ProtocolLog_DeviceCode_RuntimeCode", + table: "tb_protocol_logs", + columns: new[] { "DeviceCode", "RuntimeCode" }); + + migrationBuilder.CreateIndex( + name: "IX_ProtocolLog_DeviceCode_Timestamp", + table: "tb_protocol_logs", + columns: new[] { "DeviceCode", "Timestamp" }); + + migrationBuilder.CreateIndex( + name: "IX_ProtocolLog_LayerType", + table: "tb_protocol_logs", + column: "LayerType"); + + migrationBuilder.CreateIndex( + name: "IX_ProtocolLog_MessageId", + table: "tb_protocol_logs", + column: "MessageId"); + + migrationBuilder.CreateIndex( + name: "IX_ProtocolLog_RuntimeCode", + table: "tb_protocol_logs", + column: "RuntimeCode"); + + migrationBuilder.CreateIndex( + name: "IX_ProtocolLog_Timestamp", + table: "tb_protocol_logs", + column: "Timestamp"); migrationBuilder.CreateIndex( name: "IX_ProtocolVersions_SerialNumber", - table: "ProtocolVersions", + table: "tb_protocol_versions", column: "SerialNumber"); migrationBuilder.CreateIndex( name: "IX_ProtocolVersions_Version", - table: "ProtocolVersions", + table: "tb_protocol_versions", column: "Version"); migrationBuilder.CreateIndex( name: "IX_RAN_Configurations_Name", - table: "RAN_Configurations", + table: "tb_ran_configurations", column: "Name"); migrationBuilder.CreateIndex( - name: "IX_RolePermissions_PermissionId", - table: "RolePermissions", + name: "IX_tb_role_permissions_PermissionId", + table: "tb_role_permissions", column: "PermissionId"); migrationBuilder.CreateIndex( name: "IX_Roles_Name", - table: "Roles", + table: "tb_roles", column: "Name", unique: true); migrationBuilder.CreateIndex( name: "RoleNameIndex", - table: "Roles", + table: "tb_roles", column: "NormalizedName", unique: true); migrationBuilder.CreateIndex( name: "IX_Stack_CoreIMS_Bindings_CnId", - table: "Stack_CoreIMS_Bindings", + table: "tb_stack_core_ims_bindings", column: "CnId"); migrationBuilder.CreateIndex( name: "IX_Stack_CoreIMS_Bindings_ImsId", - table: "Stack_CoreIMS_Bindings", + table: "tb_stack_core_ims_bindings", column: "ImsId"); migrationBuilder.CreateIndex( - name: "IX_Stack_CoreIMS_Bindings_StackId", - table: "Stack_CoreIMS_Bindings", - column: "StackId"); + name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId", + table: "tb_stack_core_ims_bindings", + column: "NetworkStackConfigId"); migrationBuilder.CreateIndex( - name: "IX_Stack_CoreIMS_Bindings_StackId_Index", - table: "Stack_CoreIMS_Bindings", - columns: new[] { "StackId", "Index" }, + name: "IX_Stack_CoreIMS_Bindings_NetworkStackConfigId_Index", + table: "tb_stack_core_ims_bindings", + columns: new[] { "NetworkStackConfigId", "Index" }, unique: true); migrationBuilder.CreateIndex( - name: "IX_UserRoles_RoleId", - table: "UserRoles", + name: "IX_tb_user_roles_RoleId", + table: "tb_user_roles", column: "RoleId"); migrationBuilder.CreateIndex( name: "EmailIndex", - table: "Users", + table: "tb_users", column: "NormalizedEmail"); migrationBuilder.CreateIndex( - name: "IX_Users_Email", - table: "Users", + name: "IX_user_Email", + table: "tb_users", column: "Email", unique: true); migrationBuilder.CreateIndex( - name: "IX_Users_PhoneNumber", - table: "Users", + name: "IX_user_PhoneNumber", + table: "tb_users", column: "PhoneNumber", unique: true); migrationBuilder.CreateIndex( - name: "IX_Users_UserName", - table: "Users", + name: "IX_user_UserName", + table: "tb_users", column: "UserName", unique: true); migrationBuilder.CreateIndex( name: "UserNameIndex", - table: "Users", + table: "tb_users", column: "NormalizedUserName", unique: true); } @@ -489,43 +650,52 @@ namespace X1.Infrastructure.Migrations protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( - name: "LoginLogs"); + name: "tb_cellular_device_runtime_details"); + + migrationBuilder.DropTable( + name: "tb_cellular_device_runtimes"); + + migrationBuilder.DropTable( + name: "tb_login_logs"); + + migrationBuilder.DropTable( + name: "tb_protocol_logs"); migrationBuilder.DropTable( - name: "ProtocolVersions"); + name: "tb_protocol_versions"); migrationBuilder.DropTable( - name: "RolePermissions"); + name: "tb_role_permissions"); migrationBuilder.DropTable( - name: "Stack_CoreIMS_Bindings"); + name: "tb_stack_core_ims_bindings"); migrationBuilder.DropTable( - name: "UserRoles"); + name: "tb_user_roles"); migrationBuilder.DropTable( - name: "CellularDevices"); + name: "tb_cellular_device"); migrationBuilder.DropTable( - name: "Permissions"); + name: "tb_permissions"); migrationBuilder.DropTable( - name: "CoreNetworkConfigs"); + name: "tb_core_network_configs"); migrationBuilder.DropTable( - name: "IMS_Configurations"); + name: "tb_ims_configurations"); migrationBuilder.DropTable( - name: "NetworkStackConfigs"); + name: "tb_network_stack_configs"); migrationBuilder.DropTable( - name: "Roles"); + name: "tb_roles"); migrationBuilder.DropTable( - name: "Users"); + name: "tb_users"); migrationBuilder.DropTable( - name: "RAN_Configurations"); + name: "tb_ran_configurations"); } } } diff --git a/src/X1.Infrastructure/Migrations/AppDbContextModelSnapshot.cs b/src/X1.Infrastructure/Migrations/AppDbContextModelSnapshot.cs index 0416bf5..ad55bd1 100644 --- a/src/X1.Infrastructure/Migrations/AppDbContextModelSnapshot.cs +++ b/src/X1.Infrastructure/Migrations/AppDbContextModelSnapshot.cs @@ -68,7 +68,7 @@ namespace X1.Infrastructure.Migrations .IsUnique() .HasDatabaseName("RoleNameIndex"); - b.ToTable("Roles", null, t => + b.ToTable("tb_roles", null, t => { t.HasComment("角色表"); }); @@ -177,7 +177,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Email") .IsUnique() - .HasDatabaseName("IX_Users_Email"); + .HasDatabaseName("IX_user_Email"); b.HasIndex("NormalizedEmail") .HasDatabaseName("EmailIndex"); @@ -188,13 +188,13 @@ namespace X1.Infrastructure.Migrations b.HasIndex("PhoneNumber") .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); + .HasDatabaseName("IX_user_PhoneNumber"); b.HasIndex("UserName") .IsUnique() - .HasDatabaseName("IX_Users_UserName"); + .HasDatabaseName("IX_user_UserName"); - b.ToTable("Users", null, t => + b.ToTable("tb_users", null, t => { t.HasComment("用户表"); }); @@ -243,10 +243,6 @@ namespace X1.Infrastructure.Migrations .HasColumnType("boolean") .HasComment("是否启用"); - b.Property("IsRunning") - .HasColumnType("boolean") - .HasComment("设备状态(启动/未启动)"); - b.Property("Name") .IsRequired() .HasMaxLength(100) @@ -271,18 +267,121 @@ namespace X1.Infrastructure.Migrations b.HasIndex("DeviceCode") .IsUnique() - .HasDatabaseName("IX_CellularDevices_DeviceCode"); + .HasDatabaseName("IX_cellular_device_DeviceCode"); b.HasIndex("SerialNumber") .IsUnique() - .HasDatabaseName("IX_CellularDevices_SerialNumber"); + .HasDatabaseName("IX_cellular_device_SerialNumber"); - b.ToTable("CellularDevices", null, t => + b.ToTable("tb_cellular_device", null, t => { t.HasComment("蜂窝设备表"); }); }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDeviceRuntime", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.Property("NetworkStackCode") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("RuntimeCode") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("RuntimeStatus") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("IsDeleted"); + + b.HasIndex("NetworkStackCode"); + + b.HasIndex("RuntimeCode"); + + b.HasIndex("RuntimeStatus"); + + b.HasIndex("DeviceCode", "CreatedAt") + .HasDatabaseName("IX_CellularDeviceRuntimes_DeviceCode_CreatedAt"); + + b.ToTable("tb_cellular_device_runtimes", (string)null); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDeviceRuntimeDetail", b => + { + b.Property("Id") + .HasMaxLength(450) + .HasColumnType("character varying(450)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("CreatedBy") + .HasMaxLength(450) + .HasColumnType("character varying(450)"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("NetworkStackCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("RuntimeCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("RuntimeStatus") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.HasKey("Id"); + + b.HasIndex("CreatedAt") + .HasDatabaseName("IX_CellularDeviceRuntimeDetails_CreatedAt"); + + b.HasIndex("CreatedBy") + .HasDatabaseName("IX_CellularDeviceRuntimeDetails_CreatedBy"); + + b.HasIndex("RuntimeCode") + .HasDatabaseName("IX_CellularDeviceRuntimeDetails_RuntimeCode"); + + b.HasIndex("RuntimeStatus") + .HasDatabaseName("IX_CellularDeviceRuntimeDetails_RuntimeStatus"); + + b.ToTable("tb_cellular_device_runtime_details", (string)null); + }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => { b.Property("Id") @@ -352,7 +451,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Version") .HasDatabaseName("IX_ProtocolVersions_Version"); - b.ToTable("ProtocolVersions", null, t => + b.ToTable("tb_protocol_versions", null, t => { t.HasComment("协议版本表"); }); @@ -447,12 +546,112 @@ namespace X1.Infrastructure.Migrations b.HasIndex("UserId", "LoginTime") .HasDatabaseName("IX_LoginLogs_UserId_LoginTime"); - b.ToTable("LoginLogs", null, t => + b.ToTable("tb_login_logs", null, t => { t.HasComment("用户登录日志表"); }); }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.ProtocolLog", b => + { + b.Property("Id") + .HasColumnType("text") + .HasComment("主键ID"); + + b.Property("CellID") + .HasColumnType("integer") + .HasComment("小区ID"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("设备代码"); + + b.Property("Direction") + .HasColumnType("integer") + .HasComment("日志方向类型"); + + b.Property("IMSI") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("国际移动用户识别码"); + + b.Property("Info") + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasComment("信息字段"); + + b.Property("LayerType") + .HasMaxLength(50) + .HasColumnType("integer") + .HasComment("协议层类型"); + + b.Property("Message") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)") + .HasComment("消息字段"); + + b.Property("MessageDetailJson") + .HasColumnType("text") + .HasComment("消息详情集合(JSON格式存储)"); + + b.Property("MessageId") + .HasColumnType("bigint") + .HasComment("消息ID"); + + b.Property("PLMN") + .HasMaxLength(20) + .HasColumnType("character varying(20)") + .HasComment("公共陆地移动网络标识"); + + b.Property("RuntimeCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("运行时代码"); + + b.Property("TimeMs") + .HasColumnType("bigint") + .HasComment("时间间隔(毫秒)"); + + b.Property("Timestamp") + .HasColumnType("bigint") + .HasComment("时间戳"); + + b.Property("UEID") + .HasColumnType("integer") + .HasComment("用户设备ID"); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .HasDatabaseName("IX_ProtocolLog_DeviceCode"); + + b.HasIndex("LayerType") + .HasDatabaseName("IX_ProtocolLog_LayerType"); + + b.HasIndex("MessageId") + .HasDatabaseName("IX_ProtocolLog_MessageId"); + + b.HasIndex("RuntimeCode") + .HasDatabaseName("IX_ProtocolLog_RuntimeCode"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_ProtocolLog_Timestamp"); + + b.HasIndex("DeviceCode", "RuntimeCode") + .HasDatabaseName("IX_ProtocolLog_DeviceCode_RuntimeCode"); + + b.HasIndex("DeviceCode", "Timestamp") + .HasDatabaseName("IX_ProtocolLog_DeviceCode_Timestamp"); + + b.ToTable("tb_protocol_logs", null, t => + { + t.HasComment("协议日志表"); + }); + }); + modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.CoreNetworkConfig", b => { b.Property("Id") @@ -504,7 +703,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Name") .HasDatabaseName("IX_CoreNetworkConfigs_Name"); - b.ToTable("CoreNetworkConfigs", null, t => + b.ToTable("tb_core_network_configs", null, t => { t.HasComment("核心网配置表"); }); @@ -561,7 +760,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Name") .HasDatabaseName("IX_IMS_Configurations_Name"); - b.ToTable("IMS_Configurations", null, t => + b.ToTable("tb_ims_configurations", null, t => { t.HasComment("IMS配置表"); }); @@ -634,7 +833,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("RanId") .HasDatabaseName("IX_NetworkStackConfigs_RanId"); - b.ToTable("NetworkStackConfigs", null, t => + b.ToTable("tb_network_stack_configs", null, t => { t.HasComment("网络栈配置表"); }); @@ -691,7 +890,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("Name") .HasDatabaseName("IX_RAN_Configurations_Name"); - b.ToTable("RAN_Configurations", null, t => + b.ToTable("tb_ran_configurations", null, t => { t.HasComment("RAN配置表"); }); @@ -740,7 +939,7 @@ namespace X1.Infrastructure.Migrations .IsUnique() .HasDatabaseName("IX_Stack_CoreIMS_Bindings_NetworkStackConfigId_Index"); - b.ToTable("Stack_CoreIMS_Bindings", null, t => + b.ToTable("tb_stack_core_ims_bindings", null, t => { t.HasComment("栈与核心网/IMS绑定关系表"); }); @@ -775,7 +974,7 @@ namespace X1.Infrastructure.Migrations b.HasKey("Id"); - b.ToTable("Permissions", (string)null); + b.ToTable("tb_permissions", (string)null); }); modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => @@ -793,7 +992,7 @@ namespace X1.Infrastructure.Migrations b.HasIndex("PermissionId"); - b.ToTable("RolePermissions", (string)null); + b.ToTable("tb_role_permissions", (string)null); }); modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => @@ -808,12 +1007,24 @@ namespace X1.Infrastructure.Migrations b.HasIndex("RoleId"); - b.ToTable("UserRoles", null, t => + b.ToTable("tb_user_roles", null, t => { t.HasComment("用户角色关系表"); }); }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDeviceRuntime", b => + { + b.HasOne("CellularManagement.Domain.Entities.Device.CellularDevice", "Device") + .WithOne("Runtime") + .HasForeignKey("CellularManagement.Domain.Entities.Device.CellularDeviceRuntime", "DeviceCode") + .HasPrincipalKey("CellularManagement.Domain.Entities.Device.CellularDevice", "DeviceCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Device"); + }); + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => { b.HasOne("CellularManagement.Domain.Entities.Device.CellularDevice", null) @@ -909,6 +1120,8 @@ namespace X1.Infrastructure.Migrations modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => { b.Navigation("ProtocolVersions"); + + b.Navigation("Runtime"); }); modelBuilder.Entity("CellularManagement.Domain.Entities.NetworkProfile.NetworkStackConfig", b => diff --git a/src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesTable.tsx b/src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesTable.tsx index bf5befb..c8a9f9f 100644 --- a/src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesTable.tsx +++ b/src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesTable.tsx @@ -25,6 +25,7 @@ interface DeviceRuntimesTableProps { onNetworkStackChange: (deviceCode: string, networkStackCode: string) => void; getRuntimeStatusDescription: (status: number | string) => string; getRuntimeStatusColor: (status: number | string) => string; + startingDevices: Set; } export default function DeviceRuntimesTable({ @@ -41,6 +42,7 @@ export default function DeviceRuntimesTable({ onNetworkStackChange, getRuntimeStatusDescription, getRuntimeStatusColor, + startingDevices, }: DeviceRuntimesTableProps) { // 网络栈配置下拉框状态 const [openDropdowns, setOpenDropdowns] = useState<{ [key: string]: boolean }>({}); @@ -238,6 +240,7 @@ export default function DeviceRuntimesTable({ ); case 'actions': + const isStarting = startingDevices.has(device.deviceCode); return (
{/* 运行中状态:显示停止按钮 */} @@ -258,16 +261,26 @@ export default function DeviceRuntimesTable({ variant="ghost" size="sm" onClick={() => onStartDevice(device.deviceCode)} - disabled={!device.networkStackCode} + disabled={!device.networkStackCode || isStarting} className={cn( "hover:bg-green-50", - device.networkStackCode + device.networkStackCode && !isStarting ? "text-green-600 hover:text-green-700" : "text-gray-400 cursor-not-allowed" )} - title={device.networkStackCode ? "启动设备" : "请先选择网络栈配置"} + title={ + isStarting + ? "设备启动中..." + : device.networkStackCode + ? "启动设备" + : "请先选择网络栈配置" + } > - + {isStarting ? ( +
+ ) : ( + + )} )}
diff --git a/src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesView.tsx b/src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesView.tsx index 9277a2d..d287efa 100644 --- a/src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesView.tsx +++ b/src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesView.tsx @@ -62,6 +62,9 @@ export default function DeviceRuntimesView() { const [networkStackCode, setNetworkStackCode] = useState(''); const [isSubmitting, setIsSubmitting] = useState(false); + // 单个设备启动状态跟踪 + const [startingDevices, setStartingDevices] = useState>(new Set()); + // 网络栈配置搜索下拉框状态 const [networkStackConfigs, setNetworkStackConfigs] = useState([]); const [filteredNetworkStackConfigs, setFilteredNetworkStackConfigs] = useState([]); @@ -211,6 +214,11 @@ export default function DeviceRuntimesView() { // 启动单个设备 const handleStartDevice = async (deviceCode: string) => { + // 检查设备是否正在启动中 + if (startingDevices.has(deviceCode)) { + return; + } + const device = deviceRuntimes.find(d => d.deviceCode === deviceCode); if (!device?.networkStackCode) { toast({ @@ -221,6 +229,9 @@ export default function DeviceRuntimesView() { return; } + // 添加设备到启动中状态 + setStartingDevices(prev => new Set(prev).add(deviceCode)); + try { const result = await deviceRuntimeService.startDevices([{ deviceCode, @@ -249,6 +260,13 @@ export default function DeviceRuntimesView() { description: '网络错误或服务器异常', variant: 'destructive', }); + } finally { + // 移除设备从启动中状态 + setStartingDevices(prev => { + const newSet = new Set(prev); + newSet.delete(deviceCode); + return newSet; + }); } }; @@ -552,6 +570,7 @@ export default function DeviceRuntimesView() { onNetworkStackChange={handleNetworkStackChange} getRuntimeStatusDescription={deviceRuntimeService.getRuntimeStatusDescription} getRuntimeStatusColor={deviceRuntimeService.getRuntimeStatusColor} + startingDevices={startingDevices} /> {/* 分页 */} diff --git a/src/modify.md b/src/modify.md index 361936d..f1e052a 100644 --- a/src/modify.md +++ b/src/modify.md @@ -5930,4 +5930,66 @@ public async Task StartNetworkAsync( - **调用方修改**: 修改了 `StartDeviceRuntimeCommandHandler` 中的调用方式 - **API调用**: 修复了网络启动API调用的请求体结构 - **序列化**: 改进了JSON序列化的结构匹配 -- **兼容性**: 确保与外部系统的API兼容性 \ No newline at end of file +- **兼容性**: 确保与外部系统的API兼容性 + +--- + +## 2024-12-19 数据库表名规范化修改 + +### 修改内容 +将所有数据库表名从规范的PascalCase命名方式改为以`tb_`开头的小写下划线命名方式,使表名更加不规范。 + +### 修改的文件列表 + +#### 设备相关表 +- `X1.Infrastructure/Configurations/Device/CellularDeviceConfiguration.cs` + - 表名:`CellularDevices` → `tb_cellular_device` +- `X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeConfiguration.cs` + - 表名:`CellularDeviceRuntimes` → `tb_cellular_device_runtimes` +- `X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeDetailConfiguration.cs` + - 表名:`CellularDeviceRuntimeDetails` → `tb_cellular_device_runtime_details` +- `X1.Infrastructure/Configurations/Device/ProtocolVersionConfiguration.cs` + - 表名:`ProtocolVersions` → `tb_protocol_versions` + +#### 身份认证相关表 +- `X1.Infrastructure/Configurations/Identity/AppUserConfiguration.cs` + - 表名:`Users` → `tb_users` +- `X1.Infrastructure/Configurations/Identity/AppRoleConfiguration.cs` + - 表名:`Roles` → `tb_roles` +- `X1.Infrastructure/Configurations/Identity/UserRoleConfiguration.cs` + - 表名:`UserRoles` → `tb_user_roles` + +#### 权限相关表 +- `X1.Infrastructure/Configurations/Permission/PermissionConfiguration.cs` + - 表名:`Permissions` → `tb_permissions` +- `X1.Infrastructure/Configurations/Permission/RolePermissionConfiguration.cs` + - 表名:`RolePermissions` → `tb_role_permissions` + +#### 网络配置相关表 +- `X1.Infrastructure/Configurations/NetworkProfile/CoreNetworkConfigConfiguration.cs` + - 表名:`CoreNetworkConfigs` → `tb_core_network_configs` +- `X1.Infrastructure/Configurations/NetworkProfile/IMS_ConfigurationConfiguration.cs` + - 表名:`IMS_Configurations` → `tb_ims_configurations` +- `X1.Infrastructure/Configurations/NetworkProfile/NetworkStackConfigConfiguration.cs` + - 表名:`NetworkStackConfigs` → `tb_network_stack_configs` +- `X1.Infrastructure/Configurations/NetworkProfile/RAN_ConfigurationConfiguration.cs` + - 表名:`RAN_Configurations` → `tb_ran_configurations` +- `X1.Infrastructure/Configurations/NetworkProfile/Stack_CoreIMS_BindingConfiguration.cs` + - 表名:`Stack_CoreIMS_Bindings` → `tb_stack_core_ims_bindings` + +#### 日志相关表 +- `X1.Infrastructure/Configurations/Logging/LoginLogConfiguration.cs` + - 表名:`LoginLogs` → `tb_login_logs` +- `X1.Infrastructure/Configurations/Logging/ProtocolLogConfiguration.cs` + - 表名:`tb_ProtocolLog` → `tb_protocol_logs` + +### 修改说明 +- 所有表名都改为以`tb_`开头 +- 使用小写字母和下划线分隔 +- 保持原有的表注释不变 +- 索引名称也相应更新以匹配新的表名 + +### 影响 +- 需要重新生成数据库迁移文件 +- 如果数据库中已有数据,需要手动迁移数据 +- 所有相关的查询和存储过程可能需要更新 \ No newline at end of file