Browse Source

feat: 重新生成数据库迁移文件,更新所有表名为tb_开头格式

- 删除所有现有迁移文件
- 重新创建初始迁移文件
- 更新所有表名为tb_开头的小写下划线格式
- 修改的配置文件包括:
  * 设备相关表配置
  * 身份认证相关表配置
  * 权限相关表配置
  * 网络配置相关表配置
  * 日志相关表配置
- 更新modify.md记录修改历史
feature/x1-web-request
hyh 2 days ago
parent
commit
e048132dcd
  1. 6
      src/X1.Infrastructure/Configurations/Device/CellularDeviceConfiguration.cs
  2. 2
      src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeConfiguration.cs
  3. 2
      src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeDetailConfiguration.cs
  4. 2
      src/X1.Infrastructure/Configurations/Device/ProtocolVersionConfiguration.cs
  5. 2
      src/X1.Infrastructure/Configurations/Identity/AppRoleConfiguration.cs
  6. 8
      src/X1.Infrastructure/Configurations/Identity/AppUserConfiguration.cs
  7. 2
      src/X1.Infrastructure/Configurations/Identity/UserRoleConfiguration.cs
  8. 2
      src/X1.Infrastructure/Configurations/Logging/LoginLogConfiguration.cs
  9. 2
      src/X1.Infrastructure/Configurations/Logging/ProtocolLogConfiguration.cs
  10. 2
      src/X1.Infrastructure/Configurations/NetworkProfile/CoreNetworkConfigConfiguration.cs
  11. 2
      src/X1.Infrastructure/Configurations/NetworkProfile/IMS_ConfigurationConfiguration.cs
  12. 2
      src/X1.Infrastructure/Configurations/NetworkProfile/NetworkStackConfigConfiguration.cs
  13. 2
      src/X1.Infrastructure/Configurations/NetworkProfile/RAN_ConfigurationConfiguration.cs
  14. 2
      src/X1.Infrastructure/Configurations/NetworkProfile/Stack_CoreIMS_BindingConfiguration.cs
  15. 2
      src/X1.Infrastructure/Configurations/Permission/PermissionConfiguration.cs
  16. 2
      src/X1.Infrastructure/Configurations/Permission/RolePermissionConfiguration.cs
  17. 929
      src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.Designer.cs
  18. 909
      src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.Designer.cs
  19. 266
      src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.cs
  20. 923
      src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.Designer.cs
  21. 52
      src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.cs
  22. 76
      src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.cs
  23. 261
      src/X1.Infrastructure/Migrations/20250801075432_InitialCreate.Designer.cs
  24. 396
      src/X1.Infrastructure/Migrations/20250801075432_InitialCreate.cs
  25. 257
      src/X1.Infrastructure/Migrations/AppDbContextModelSnapshot.cs
  26. 21
      src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesTable.tsx
  27. 19
      src/X1.WebUI/src/pages/device-runtimes/DeviceRuntimesView.tsx
  28. 64
      src/modify.md

6
src/X1.Infrastructure/Configurations/Device/CellularDeviceConfiguration.cs

@ -8,12 +8,12 @@ public class CellularDeviceConfiguration : IEntityTypeConfiguration<CellularDevi
{
public void Configure(EntityTypeBuilder<CellularDevice> 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");

2
src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeConfiguration.cs

@ -11,7 +11,7 @@ public class CellularDeviceRuntimeConfiguration : IEntityTypeConfiguration<Cellu
{
public void Configure(EntityTypeBuilder<CellularDeviceRuntime> builder)
{
builder.ToTable("CellularDeviceRuntimes");
builder.ToTable("tb_cellular_device_runtimes");
builder.HasKey(x => x.Id);

2
src/X1.Infrastructure/Configurations/Device/CellularDeviceRuntimeDetailConfiguration.cs

@ -11,7 +11,7 @@ public class CellularDeviceRuntimeDetailConfiguration : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder<CellularDeviceRuntimeDetail> builder)
{
builder.ToTable("CellularDeviceRuntimeDetails");
builder.ToTable("tb_cellular_device_runtime_details");
builder.HasKey(x => x.Id);

2
src/X1.Infrastructure/Configurations/Device/ProtocolVersionConfiguration.cs

@ -8,7 +8,7 @@ public class ProtocolVersionConfiguration : IEntityTypeConfiguration<ProtocolVer
{
public void Configure(EntityTypeBuilder<ProtocolVersion> builder)
{
builder.ToTable("ProtocolVersions", t => t.HasComment("协议版本表"));
builder.ToTable("tb_protocol_versions", t => t.HasComment("协议版本表"));
builder.HasKey(v => v.Id);
// 配置索引

2
src/X1.Infrastructure/Configurations/Identity/AppRoleConfiguration.cs

@ -16,7 +16,7 @@ public sealed class AppRoleConfiguration : IEntityTypeConfiguration<AppRole>
public void Configure(EntityTypeBuilder<AppRole> builder)
{
// 配置表名
builder.ToTable("Roles", t => t.HasComment("角色表"));
builder.ToTable("tb_roles", t => t.HasComment("角色表"));
// 配置索引
builder.HasIndex(r => r.Name)

8
src/X1.Infrastructure/Configurations/Identity/AppUserConfiguration.cs

@ -17,12 +17,12 @@ public sealed class AppUserConfiguration : IEntityTypeConfiguration<AppUser>
public void Configure(EntityTypeBuilder<AppUser> 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");

2
src/X1.Infrastructure/Configurations/Identity/UserRoleConfiguration.cs

@ -15,7 +15,7 @@ public sealed class UserRoleConfiguration : IEntityTypeConfiguration<UserRole>
public void Configure(EntityTypeBuilder<UserRole> builder)
{
// 配置表名
builder.ToTable("UserRoles", t => t.HasComment("用户角色关系表"));
builder.ToTable("tb_user_roles", t => t.HasComment("用户角色关系表"));
// 配置主键
builder.HasKey(ur => new { ur.UserId, ur.RoleId });

2
src/X1.Infrastructure/Configurations/Logging/LoginLogConfiguration.cs

@ -18,7 +18,7 @@ public sealed class LoginLogConfiguration : IEntityTypeConfiguration<LoginLog>
public void Configure(EntityTypeBuilder<LoginLog> builder)
{
// 配置表名
builder.ToTable("LoginLogs", t => t.HasComment("用户登录日志表"));
builder.ToTable("tb_login_logs", t => t.HasComment("用户登录日志表"));
// 配置主键
builder.HasKey(l => l.Id);

2
src/X1.Infrastructure/Configurations/Logging/ProtocolLogConfiguration.cs

@ -17,7 +17,7 @@ public sealed class ProtocolLogConfiguration : IEntityTypeConfiguration<Protocol
public void Configure(EntityTypeBuilder<ProtocolLog> builder)
{
// 配置表名
builder.ToTable("tb_ProtocolLog", t => t.HasComment("协议日志表"));
builder.ToTable("tb_protocol_logs", t => t.HasComment("协议日志表"));
// 配置主键
builder.HasKey(p => p.Id);

2
src/X1.Infrastructure/Configurations/NetworkProfile/CoreNetworkConfigConfiguration.cs

@ -8,7 +8,7 @@ public class CoreNetworkConfigConfiguration : IEntityTypeConfiguration<CoreNetwo
{
public void Configure(EntityTypeBuilder<CoreNetworkConfig> builder)
{
builder.ToTable("CoreNetworkConfigs", t => t.HasComment("核心网配置表"));
builder.ToTable("tb_core_network_configs", t => t.HasComment("核心网配置表"));
builder.HasKey(cnc => cnc.Id);
// 配置索引

2
src/X1.Infrastructure/Configurations/NetworkProfile/IMS_ConfigurationConfiguration.cs

@ -8,7 +8,7 @@ public class IMS_ConfigurationConfiguration : IEntityTypeConfiguration<IMS_Confi
{
public void Configure(EntityTypeBuilder<IMS_Configuration> builder)
{
builder.ToTable("IMS_Configurations", t => t.HasComment("IMS配置表"));
builder.ToTable("tb_ims_configurations", t => t.HasComment("IMS配置表"));
builder.HasKey(ic => ic.Id);
// 配置索引

2
src/X1.Infrastructure/Configurations/NetworkProfile/NetworkStackConfigConfiguration.cs

@ -8,7 +8,7 @@ public class NetworkStackConfigConfiguration : IEntityTypeConfiguration<NetworkS
{
public void Configure(EntityTypeBuilder<NetworkStackConfig> builder)
{
builder.ToTable("NetworkStackConfigs", t => t.HasComment("网络栈配置表"));
builder.ToTable("tb_network_stack_configs", t => t.HasComment("网络栈配置表"));
builder.HasKey(nsc => nsc.Id);
// 配置索引

2
src/X1.Infrastructure/Configurations/NetworkProfile/RAN_ConfigurationConfiguration.cs

@ -9,7 +9,7 @@ public class RAN_ConfigurationConfiguration : IEntityTypeConfiguration<RAN_Confi
{
public void Configure(EntityTypeBuilder<RAN_Configuration> builder)
{
builder.ToTable("RAN_Configurations", t => t.HasComment("RAN配置表"));
builder.ToTable("tb_ran_configurations", t => t.HasComment("RAN配置表"));
builder.HasKey(rc => rc.Id);
// 配置索引

2
src/X1.Infrastructure/Configurations/NetworkProfile/Stack_CoreIMS_BindingConfiguration.cs

@ -8,7 +8,7 @@ public class Stack_CoreIMS_BindingConfiguration : IEntityTypeConfiguration<Stack
{
public void Configure(EntityTypeBuilder<Stack_CoreIMS_Binding> 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

2
src/X1.Infrastructure/Configurations/Permission/PermissionConfiguration.cs

@ -8,7 +8,7 @@ public class PermissionConfiguration : IEntityTypeConfiguration<CellularManageme
{
public void Configure(EntityTypeBuilder<CellularManagement.Domain.Entities.Permission> 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);

2
src/X1.Infrastructure/Configurations/Permission/RolePermissionConfiguration.cs

@ -8,7 +8,7 @@ public class RolePermissionConfiguration : IEntityTypeConfiguration<RolePermissi
{
public void Configure(EntityTypeBuilder<RolePermission> builder)
{
builder.ToTable("RolePermissions");
builder.ToTable("tb_role_permissions");
builder.HasKey(rp => new { rp.RoleId, rp.PermissionId });
builder.Property(rp => rp.CreatedAt).IsRequired();

929
src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.Designer.cs

@ -1,929 +0,0 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<string>("Id")
.HasColumnType("text")
.HasComment("角色ID,主键");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text")
.HasComment("并发控制戳");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("角色描述");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("角色名称");
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("标准化角色名称(大写)");
b.Property<DateTime>("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<string>("Id")
.HasColumnType("text")
.HasComment("用户ID,主键");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer")
.HasComment("登录失败次数");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text")
.HasComment("并发控制戳");
b.Property<DateTime>("CreatedTime")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("电子邮箱");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean")
.HasComment("邮箱是否已验证");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true)
.HasComment("用户状态(true: 启用, false: 禁用)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasComment("是否已删除");
b.Property<DateTime?>("LastLoginTime")
.HasColumnType("timestamp with time zone")
.HasComment("最后登录时间");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean")
.HasComment("是否启用账户锁定");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone")
.HasComment("账户锁定结束时间");
b.Property<DateTime?>("ModifiedTime")
.HasColumnType("timestamp with time zone")
.HasComment("修改时间");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("标准化电子邮箱(大写)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("标准化账号(大写)");
b.Property<string>("PasswordHash")
.HasColumnType("text")
.HasComment("密码哈希值");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text")
.HasComment("电话号码");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean")
.HasComment("电话号码是否已验证");
b.Property<string>("RealName")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("用户名");
b.Property<string>("SecurityStamp")
.HasColumnType("text")
.HasComment("安全戳,用于并发控制");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean")
.HasComment("是否启用双因素认证");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("设备ID");
b.Property<int>("AgentPort")
.HasColumnType("integer")
.HasComment("Agent端口");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("设备描述");
b.Property<string>("IpAddress")
.IsRequired()
.HasMaxLength(45)
.HasColumnType("character varying(45)")
.HasComment("IP地址");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean")
.HasComment("是否启用");
b.Property<bool>("IsRunning")
.HasColumnType("boolean")
.HasComment("设备状态(启动/未启动)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("设备名称");
b.Property<string>("SerialNumber")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("序列号");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("版本ID");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("版本描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean")
.HasComment("是否启用");
b.Property<string>("MinimumSupportedVersion")
.HasMaxLength(20)
.HasColumnType("character varying(20)")
.HasComment("最低支持版本");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("版本名称");
b.Property<DateTime?>("ReleaseDate")
.HasColumnType("timestamp with time zone")
.HasComment("发布日期");
b.Property<string>("SerialNumber")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("设备序列号");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("日志ID");
b.Property<string>("Browser")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("浏览器信息");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FailureReason")
.HasMaxLength(200)
.HasColumnType("character varying(200)")
.HasComment("失败原因");
b.Property<string>("IpAddress")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("登录IP");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsSuccess")
.HasColumnType("boolean")
.HasComment("登录状态(成功/失败)");
b.Property<string>("Location")
.HasMaxLength(200)
.HasColumnType("character varying(200)")
.HasComment("登录位置");
b.Property<string>("LoginSource")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("LoginTime")
.HasColumnType("timestamp with time zone")
.HasComment("登录时间");
b.Property<string>("LoginType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("OperatingSystem")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("操作系统信息");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserAgent")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("设备信息");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<string>("ConfigContent")
.IsRequired()
.HasColumnType("text")
.HasComment("配置内容(JSON格式)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("配置描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsDisabled")
.HasColumnType("boolean")
.HasComment("是否禁用");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("配置名称");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<string>("ConfigContent")
.IsRequired()
.HasColumnType("text")
.HasComment("配置内容(JSON格式)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("配置描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsDisabled")
.HasColumnType("boolean")
.HasComment("是否禁用");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("配置名称");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("描述");
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasComment("是否激活");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<string>("RanId")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("RAN配置ID");
b.Property<string>("StackId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("栈ID");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<string>("ConfigContent")
.IsRequired()
.HasColumnType("text")
.HasComment("配置内容(JSON格式)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("配置描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsDisabled")
.HasColumnType("boolean")
.HasComment("是否禁用");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("配置名称");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("绑定关系ID");
b.Property<string>("CnId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("核心网配置ID");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ImsId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("IMS配置ID");
b.Property<int>("Index")
.HasColumnType("integer")
.HasComment("索引");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<string>("StackId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("栈ID");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("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<string>("RoleId")
.HasColumnType("text");
b.Property<string>("PermissionId")
.HasColumnType("text");
b.Property<DateTime>("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<string>("UserId")
.HasColumnType("text");
b.Property<string>("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
}
}
}

909
src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.Designer.cs

@ -1,909 +0,0 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<string>("Id")
.HasColumnType("text")
.HasComment("角色ID,主键");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text")
.HasComment("并发控制戳");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("角色描述");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("角色名称");
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("标准化角色名称(大写)");
b.Property<DateTime>("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<string>("Id")
.HasColumnType("text")
.HasComment("用户ID,主键");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer")
.HasComment("登录失败次数");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text")
.HasComment("并发控制戳");
b.Property<DateTime>("CreatedTime")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("电子邮箱");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean")
.HasComment("邮箱是否已验证");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true)
.HasComment("用户状态(true: 启用, false: 禁用)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasComment("是否已删除");
b.Property<DateTime?>("LastLoginTime")
.HasColumnType("timestamp with time zone")
.HasComment("最后登录时间");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean")
.HasComment("是否启用账户锁定");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone")
.HasComment("账户锁定结束时间");
b.Property<DateTime?>("ModifiedTime")
.HasColumnType("timestamp with time zone")
.HasComment("修改时间");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("标准化电子邮箱(大写)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("标准化账号(大写)");
b.Property<string>("PasswordHash")
.HasColumnType("text")
.HasComment("密码哈希值");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text")
.HasComment("电话号码");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean")
.HasComment("电话号码是否已验证");
b.Property<string>("RealName")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("用户名");
b.Property<string>("SecurityStamp")
.HasColumnType("text")
.HasComment("安全戳,用于并发控制");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean")
.HasComment("是否启用双因素认证");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("设备ID");
b.Property<int>("AgentPort")
.HasColumnType("integer")
.HasComment("Agent端口");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("设备描述");
b.Property<string>("IpAddress")
.IsRequired()
.HasMaxLength(45)
.HasColumnType("character varying(45)")
.HasComment("IP地址");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean")
.HasComment("是否启用");
b.Property<bool>("IsRunning")
.HasColumnType("boolean")
.HasComment("设备状态(启动/未启动)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("设备名称");
b.Property<string>("SerialNumber")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("序列号");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("版本ID");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("版本描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean")
.HasComment("是否启用");
b.Property<string>("MinimumSupportedVersion")
.HasMaxLength(20)
.HasColumnType("character varying(20)")
.HasComment("最低支持版本");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("版本名称");
b.Property<DateTime?>("ReleaseDate")
.HasColumnType("timestamp with time zone")
.HasComment("发布日期");
b.Property<string>("SerialNumber")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("设备序列号");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("日志ID");
b.Property<string>("Browser")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("浏览器信息");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FailureReason")
.HasMaxLength(200)
.HasColumnType("character varying(200)")
.HasComment("失败原因");
b.Property<string>("IpAddress")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("登录IP");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsSuccess")
.HasColumnType("boolean")
.HasComment("登录状态(成功/失败)");
b.Property<string>("Location")
.HasMaxLength(200)
.HasColumnType("character varying(200)")
.HasComment("登录位置");
b.Property<string>("LoginSource")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("LoginTime")
.HasColumnType("timestamp with time zone")
.HasComment("登录时间");
b.Property<string>("LoginType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("OperatingSystem")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("操作系统信息");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserAgent")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("设备信息");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<string>("ConfigContent")
.IsRequired()
.HasColumnType("text")
.HasComment("配置内容(JSON格式)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("配置描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsDisabled")
.HasColumnType("boolean")
.HasComment("是否禁用");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("配置名称");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<string>("ConfigContent")
.IsRequired()
.HasColumnType("text")
.HasComment("配置内容(JSON格式)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("配置描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsDisabled")
.HasColumnType("boolean")
.HasComment("是否禁用");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("配置名称");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("描述");
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasComment("是否激活");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<string>("NetworkStackName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("网络栈名称");
b.Property<string>("RanId")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("RAN配置ID");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<string>("ConfigContent")
.IsRequired()
.HasColumnType("text")
.HasComment("配置内容(JSON格式)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("配置描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsDisabled")
.HasColumnType("boolean")
.HasComment("是否禁用");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("配置名称");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("绑定关系ID");
b.Property<string>("CnId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("核心网配置ID");
b.Property<string>("ImsId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("IMS配置ID");
b.Property<int>("Index")
.HasColumnType("integer")
.HasComment("索引");
b.Property<string>("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<string>("Id")
.HasColumnType("text");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("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<string>("RoleId")
.HasColumnType("text");
b.Property<string>("PermissionId")
.HasColumnType("text");
b.Property<DateTime>("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<string>("UserId")
.HasColumnType("text");
b.Property<string>("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
}
}
}

266
src/X1.Infrastructure/Migrations/20250728164913_UpdateNetworkStackConfigAndBindings.cs

@ -1,266 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace X1.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class UpdateNetworkStackConfigAndBindings : Migration
{
/// <inheritdoc />
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<string>(
name: "NetworkStackConfigId",
table: "Stack_CoreIMS_Bindings",
type: "character varying(50)",
maxLength: 50,
nullable: false,
defaultValue: "",
comment: "网络栈配置ID");
migrationBuilder.AddColumn<string>(
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);
}
/// <inheritdoc />
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<DateTime>(
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<string>(
name: "CreatedBy",
table: "Stack_CoreIMS_Bindings",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "Stack_CoreIMS_Bindings",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<string>(
name: "StackId",
table: "Stack_CoreIMS_Bindings",
type: "character varying(50)",
maxLength: 50,
nullable: false,
defaultValue: "",
comment: "栈ID");
migrationBuilder.AddColumn<DateTime>(
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<string>(
name: "UpdatedBy",
table: "Stack_CoreIMS_Bindings",
type: "text",
nullable: true);
migrationBuilder.AddColumn<string>(
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);
}
}
}

923
src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.Designer.cs

@ -1,923 +0,0 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<string>("Id")
.HasColumnType("text")
.HasComment("角色ID,主键");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text")
.HasComment("并发控制戳");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("角色描述");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("角色名称");
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("标准化角色名称(大写)");
b.Property<DateTime>("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<string>("Id")
.HasColumnType("text")
.HasComment("用户ID,主键");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer")
.HasComment("登录失败次数");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text")
.HasComment("并发控制戳");
b.Property<DateTime>("CreatedTime")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("电子邮箱");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean")
.HasComment("邮箱是否已验证");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true)
.HasComment("用户状态(true: 启用, false: 禁用)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false)
.HasComment("是否已删除");
b.Property<DateTime?>("LastLoginTime")
.HasColumnType("timestamp with time zone")
.HasComment("最后登录时间");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean")
.HasComment("是否启用账户锁定");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone")
.HasComment("账户锁定结束时间");
b.Property<DateTime?>("ModifiedTime")
.HasColumnType("timestamp with time zone")
.HasComment("修改时间");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("标准化电子邮箱(大写)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)")
.HasComment("标准化账号(大写)");
b.Property<string>("PasswordHash")
.HasColumnType("text")
.HasComment("密码哈希值");
b.Property<string>("PhoneNumber")
.IsRequired()
.HasColumnType("text")
.HasComment("电话号码");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean")
.HasComment("电话号码是否已验证");
b.Property<string>("RealName")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("用户名");
b.Property<string>("SecurityStamp")
.HasColumnType("text")
.HasComment("安全戳,用于并发控制");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean")
.HasComment("是否启用双因素认证");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("设备ID");
b.Property<int>("AgentPort")
.HasColumnType("integer")
.HasComment("Agent端口");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("设备描述");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("设备编码");
b.Property<string>("IpAddress")
.IsRequired()
.HasMaxLength(45)
.HasColumnType("character varying(45)")
.HasComment("IP地址");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean")
.HasComment("是否启用");
b.Property<bool>("IsRunning")
.HasColumnType("boolean")
.HasComment("设备状态(启动/未启动)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("设备名称");
b.Property<string>("SerialNumber")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("序列号");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("版本ID");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("版本描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean")
.HasComment("是否启用");
b.Property<string>("MinimumSupportedVersion")
.HasMaxLength(20)
.HasColumnType("character varying(20)")
.HasComment("最低支持版本");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("版本名称");
b.Property<DateTime?>("ReleaseDate")
.HasColumnType("timestamp with time zone")
.HasComment("发布日期");
b.Property<string>("SerialNumber")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("设备序列号");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("UpdatedBy")
.HasColumnType("text");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("日志ID");
b.Property<string>("Browser")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("浏览器信息");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FailureReason")
.HasMaxLength(200)
.HasColumnType("character varying(200)")
.HasComment("失败原因");
b.Property<string>("IpAddress")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("登录IP");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsSuccess")
.HasColumnType("boolean")
.HasComment("登录状态(成功/失败)");
b.Property<string>("Location")
.HasMaxLength(200)
.HasColumnType("character varying(200)")
.HasComment("登录位置");
b.Property<string>("LoginSource")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("LoginTime")
.HasColumnType("timestamp with time zone")
.HasComment("登录时间");
b.Property<string>("LoginType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("OperatingSystem")
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("操作系统信息");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserAgent")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("设备信息");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<string>("ConfigContent")
.IsRequired()
.HasColumnType("text")
.HasComment("配置内容(JSON格式)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("配置描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsDisabled")
.HasColumnType("boolean")
.HasComment("是否禁用");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("配置名称");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<string>("ConfigContent")
.IsRequired()
.HasColumnType("text")
.HasComment("配置内容(JSON格式)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("配置描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsDisabled")
.HasColumnType("boolean")
.HasComment("是否禁用");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("配置名称");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("描述");
b.Property<bool>("IsActive")
.HasColumnType("boolean")
.HasComment("是否激活");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<string>("NetworkCode")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("NetworkStackName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("网络栈名称");
b.Property<string>("RanId")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("RAN配置ID");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("配置ID");
b.Property<string>("ConfigContent")
.IsRequired()
.HasColumnType("text")
.HasComment("配置内容(JSON格式)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("创建时间");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("配置描述");
b.Property<bool>("IsDeleted")
.HasColumnType("boolean");
b.Property<bool>("IsDisabled")
.HasColumnType("boolean")
.HasComment("是否禁用");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasComment("配置名称");
b.Property<DateTime?>("UpdatedAt")
.IsRequired()
.HasColumnType("timestamp with time zone")
.HasComment("更新时间");
b.Property<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("绑定关系ID");
b.Property<string>("CnId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("核心网配置ID");
b.Property<string>("ImsId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("IMS配置ID");
b.Property<int>("Index")
.HasColumnType("integer")
.HasComment("索引");
b.Property<string>("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<string>("Id")
.HasColumnType("text");
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("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<string>("RoleId")
.HasColumnType("text");
b.Property<string>("PermissionId")
.HasColumnType("text");
b.Property<DateTime>("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<string>("UserId")
.HasColumnType("text");
b.Property<string>("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
}
}
}

52
src/X1.Infrastructure/Migrations/20250729142128_AddNetworkCodeToNetworkStackConfig.cs

@ -1,52 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace X1.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddNetworkCodeToNetworkStackConfig : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "NetworkCode",
table: "NetworkStackConfigs",
type: "character varying(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
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);
}
/// <inheritdoc />
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");
}
}
}

76
src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.cs

@ -1,76 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace X1.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddNetworkStackCode : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "NetworkCode",
table: "NetworkStackConfigs");
migrationBuilder.AddColumn<string>(
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<string>(
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);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_NetworkStackConfigs_NetworkStackCode",
table: "NetworkStackConfigs");
migrationBuilder.DropColumn(
name: "NetworkStackCode",
table: "NetworkStackConfigs");
migrationBuilder.AddColumn<string>(
name: "NetworkCode",
table: "NetworkStackConfigs",
type: "character varying(50)",
maxLength: 50,
nullable: true);
}
}
}

261
src/X1.Infrastructure/Migrations/20250729144236_AddNetworkStackCode.Designer.cs → 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
{
/// <inheritdoc />
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<bool>("IsRunning")
.HasColumnType("boolean")
.HasComment("设备状态(启动/未启动)");
b.Property<string>("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<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property<string>("NetworkStackCode")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("RuntimeCode")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<int>("RuntimeStatus")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property<DateTime?>("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<string>("Id")
.HasMaxLength(450)
.HasColumnType("character varying(450)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("CreatedBy")
.HasMaxLength(450)
.HasColumnType("character varying(450)");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("NetworkStackCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("RuntimeCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<bool>("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<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("主键ID");
b.Property<int?>("CellID")
.HasColumnType("integer")
.HasComment("小区ID");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("设备代码");
b.Property<int>("Direction")
.HasColumnType("integer")
.HasComment("日志方向类型");
b.Property<string>("IMSI")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("国际移动用户识别码");
b.Property<string>("Info")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("信息字段");
b.Property<int>("LayerType")
.HasMaxLength(50)
.HasColumnType("integer")
.HasComment("协议层类型");
b.Property<string>("Message")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)")
.HasComment("消息字段");
b.Property<string>("MessageDetailJson")
.HasColumnType("text")
.HasComment("消息详情集合(JSON格式存储)");
b.Property<long>("MessageId")
.HasColumnType("bigint")
.HasComment("消息ID");
b.Property<string>("PLMN")
.HasMaxLength(20)
.HasColumnType("character varying(20)")
.HasComment("公共陆地移动网络标识");
b.Property<string>("RuntimeCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("运行时代码");
b.Property<long>("TimeMs")
.HasColumnType("bigint")
.HasComment("时间间隔(毫秒)");
b.Property<long>("Timestamp")
.HasColumnType("bigint")
.HasComment("时间戳");
b.Property<int?>("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<string>("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 =>

396
src/X1.Infrastructure/Migrations/20250728081332_InitialCreate.cs → 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<string>(type: "text", nullable: false, comment: "设备ID"),
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false, comment: "设备名称"),
SerialNumber = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "序列号"),
DeviceCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "设备编码"),
Description = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false, comment: "设备描述"),
AgentPort = table.Column<int>(type: "integer", nullable: false, comment: "Agent端口"),
IpAddress = table.Column<string>(type: "character varying(45)", maxLength: 45, nullable: false, comment: "IP地址"),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false, comment: "是否启用"),
IsRunning = table.Column<bool>(type: "boolean", nullable: false, comment: "设备状态(启动/未启动)"),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间"),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "更新时间"),
IsDeleted = table.Column<bool>(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<string>(type: "character varying(450)", maxLength: 450, nullable: false),
DeviceCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
RuntimeCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
NetworkStackCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
RuntimeStatus = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
CreatedBy = table.Column<string>(type: "character varying(450)", maxLength: 450, nullable: true),
CreatedAt = table.Column<DateTime>(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<string>(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<string>(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<string>(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<string>(type: "text", nullable: false, comment: "主键ID"),
MessageId = table.Column<long>(type: "bigint", nullable: false, comment: "消息ID"),
LayerType = table.Column<int>(type: "integer", maxLength: 50, nullable: false, comment: "协议层类型"),
MessageDetailJson = table.Column<string>(type: "text", nullable: true, comment: "消息详情集合(JSON格式存储)"),
CellID = table.Column<int>(type: "integer", nullable: true, comment: "小区ID"),
IMSI = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true, comment: "国际移动用户识别码"),
Direction = table.Column<int>(type: "integer", nullable: false, comment: "日志方向类型"),
UEID = table.Column<int>(type: "integer", nullable: true, comment: "用户设备ID"),
PLMN = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true, comment: "公共陆地移动网络标识"),
TimeMs = table.Column<long>(type: "bigint", nullable: false, comment: "时间间隔(毫秒)"),
Timestamp = table.Column<long>(type: "bigint", nullable: false, comment: "时间戳"),
Info = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true, comment: "信息字段"),
Message = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true, comment: "消息字段"),
DeviceCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "设备代码"),
RuntimeCode = table.Column<string>(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<string>(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<string>(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<string>(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<string>(type: "text", nullable: false),
DeviceCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
RuntimeStatus = table.Column<int>(type: "integer", nullable: false, defaultValue: 0),
RuntimeCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
NetworkStackCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
IsDeleted = table.Column<bool>(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<string>(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<string>(type: "text", nullable: false, comment: "配置ID"),
StackId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "栈ID"),
NetworkStackName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false, comment: "网络栈名称"),
NetworkStackCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "网络栈编码"),
RanId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true, comment: "RAN配置ID"),
Description = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true, comment: "描述"),
IsActive = table.Column<bool>(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<string>(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<string>(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<string>(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<string>(type: "text", nullable: false, comment: "绑定关系ID"),
StackId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "栈ID"),
NetworkStackConfigId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "网络配置ID"),
Index = table.Column<int>(type: "integer", nullable: false, comment: "索引"),
CnId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "核心网配置ID"),
ImsId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "IMS配置ID"),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "创建时间"),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "更新时间"),
IsDeleted = table.Column<bool>(type: "boolean", nullable: false),
CreatedBy = table.Column<string>(type: "text", nullable: false),
UpdatedBy = table.Column<string>(type: "text", nullable: true)
ImsId = table.Column<string>(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");
}
}
}

257
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<bool>("IsRunning")
.HasColumnType("boolean")
.HasComment("设备状态(启动/未启动)");
b.Property<string>("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<string>("Id")
.HasColumnType("text");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property<string>("NetworkStackCode")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("RuntimeCode")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<int>("RuntimeStatus")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0);
b.Property<DateTime?>("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<string>("Id")
.HasMaxLength(450)
.HasColumnType("character varying(450)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("CreatedBy")
.HasMaxLength(450)
.HasColumnType("character varying(450)");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("NetworkStackCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("RuntimeCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<bool>("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<string>("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<string>("Id")
.HasColumnType("text")
.HasComment("主键ID");
b.Property<int?>("CellID")
.HasColumnType("integer")
.HasComment("小区ID");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("设备代码");
b.Property<int>("Direction")
.HasColumnType("integer")
.HasComment("日志方向类型");
b.Property<string>("IMSI")
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("国际移动用户识别码");
b.Property<string>("Info")
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasComment("信息字段");
b.Property<int>("LayerType")
.HasMaxLength(50)
.HasColumnType("integer")
.HasComment("协议层类型");
b.Property<string>("Message")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)")
.HasComment("消息字段");
b.Property<string>("MessageDetailJson")
.HasColumnType("text")
.HasComment("消息详情集合(JSON格式存储)");
b.Property<long>("MessageId")
.HasColumnType("bigint")
.HasComment("消息ID");
b.Property<string>("PLMN")
.HasMaxLength(20)
.HasColumnType("character varying(20)")
.HasComment("公共陆地移动网络标识");
b.Property<string>("RuntimeCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasComment("运行时代码");
b.Property<long>("TimeMs")
.HasColumnType("bigint")
.HasComment("时间间隔(毫秒)");
b.Property<long>("Timestamp")
.HasColumnType("bigint")
.HasComment("时间戳");
b.Property<int?>("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<string>("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 =>

21
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<string>;
}
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 (
<div className="flex items-center justify-center gap-2">
{/* 运行中状态:显示停止按钮 */}
@ -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
? "启动设备"
: "请先选择网络栈配置"
}
>
<PlayIcon className="h-4 w-4" />
{isStarting ? (
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-green-600"></div>
) : (
<PlayIcon className="h-4 w-4" />
)}
</Button>
)}
</div>

19
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<Set<string>>(new Set());
// 网络栈配置搜索下拉框状态
const [networkStackConfigs, setNetworkStackConfigs] = useState<NetworkStackConfig[]>([]);
const [filteredNetworkStackConfigs, setFilteredNetworkStackConfigs] = useState<NetworkStackConfig[]>([]);
@ -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}
/>
{/* 分页 */}

64
src/modify.md

@ -5930,4 +5930,66 @@ public async Task<bool> StartNetworkAsync(
- **调用方修改**: 修改了 `StartDeviceRuntimeCommandHandler` 中的调用方式
- **API调用**: 修复了网络启动API调用的请求体结构
- **序列化**: 改进了JSON序列化的结构匹配
- **兼容性**: 确保与外部系统的API兼容性
- **兼容性**: 确保与外部系统的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_`开头
- 使用小写字母和下划线分隔
- 保持原有的表注释不变
- 索引名称也相应更新以匹配新的表名
### 影响
- 需要重新生成数据库迁移文件
- 如果数据库中已有数据,需要手动迁移数据
- 所有相关的查询和存储过程可能需要更新
Loading…
Cancel
Save