From 00933ee3ee31ffc988d18f607896a8ee01c97c5e Mon Sep 17 00:00:00 2001 From: hyh Date: Fri, 6 Jun 2025 17:46:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20250514055354_InitialCreate.Designer.cs | 282 ------------ .../20250514055354_InitialCreate.cs | 193 --------- ...250516021320_AddRoleTimestamps.Designer.cs | 290 ------------- .../20250516021320_AddRoleTimestamps.cs | 43 -- ...092205_AddAuditFieldsToAppUser.Designer.cs | 310 ------------- .../20250519092205_AddAuditFieldsToAppUser.cs | 66 --- ...405_RemoveDuplicateAuditFields.Designer.cs | 310 ------------- ...250519093405_RemoveDuplicateAuditFields.cs | 22 - ...93919_UpdateAppUserAuditFields.Designer.cs | 310 ------------- ...20250519093919_UpdateAppUserAuditFields.cs | 22 - ...0250520034505_AddLastLoginTime.Designer.cs | 314 -------------- .../20250520034505_AddLastLoginTime.cs | 30 -- .../20250520044439_AddLoginLog.Designer.cs | 396 ----------------- .../Migrations/20250520044439_AddLoginLog.cs | 69 --- ...520060054_AddRealNameToAppUser.Designer.cs | 401 ----------------- .../20250520060054_AddRealNameToAppUser.cs | 30 -- .../20250520060351_UpdateUserComments.cs | 94 ---- ... 20250606094331_InitialCreate.Designer.cs} | 335 +++++++++++++- .../20250606094331_InitialCreate.cs | 408 ++++++++++++++++++ .../Migrations/AppDbContextModelSnapshot.cs | 331 +++++++++++++- 20 files changed, 1062 insertions(+), 3194 deletions(-) delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250514055354_InitialCreate.Designer.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250514055354_InitialCreate.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250516021320_AddRoleTimestamps.Designer.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250516021320_AddRoleTimestamps.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250519092205_AddAuditFieldsToAppUser.Designer.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250519092205_AddAuditFieldsToAppUser.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250519093405_RemoveDuplicateAuditFields.Designer.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250519093405_RemoveDuplicateAuditFields.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250519093919_UpdateAppUserAuditFields.Designer.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250519093919_UpdateAppUserAuditFields.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250520034505_AddLastLoginTime.Designer.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250520034505_AddLastLoginTime.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250520044439_AddLoginLog.Designer.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250520044439_AddLoginLog.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250520060054_AddRealNameToAppUser.Designer.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250520060054_AddRealNameToAppUser.cs delete mode 100644 src/CellularManagement.Infrastructure/Migrations/20250520060351_UpdateUserComments.cs rename src/CellularManagement.Infrastructure/Migrations/{20250520060351_UpdateUserComments.Designer.cs => 20250606094331_InitialCreate.Designer.cs} (54%) create mode 100644 src/CellularManagement.Infrastructure/Migrations/20250606094331_InitialCreate.cs diff --git a/src/CellularManagement.Infrastructure/Migrations/20250514055354_InitialCreate.Designer.cs b/src/CellularManagement.Infrastructure/Migrations/20250514055354_InitialCreate.Designer.cs deleted file mode 100644 index 5f60987..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250514055354_InitialCreate.Designer.cs +++ /dev/null @@ -1,282 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250514055354_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化用户名(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("用户名"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.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.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250514055354_InitialCreate.cs b/src/CellularManagement.Infrastructure/Migrations/20250514055354_InitialCreate.cs deleted file mode 100644 index 05d2c89..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250514055354_InitialCreate.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - /// - public partial class InitialCreate : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Permissions", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - Type = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Permissions", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Roles", - columns: table => new - { - Id = table.Column(type: "text", nullable: false, comment: "角色ID,主键"), - Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true, comment: "角色描述"), - Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "角色名称"), - NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "标准化角色名称(大写)"), - ConcurrencyStamp = table.Column(type: "text", nullable: true, comment: "并发控制戳") - }, - constraints: table => - { - table.PrimaryKey("PK_Roles", x => x.Id); - }, - comment: "角色表"); - - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - Id = table.Column(type: "text", nullable: false, comment: "用户ID,主键"), - UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "用户名"), - NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "标准化用户名(大写)"), - Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "电子邮箱"), - NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "标准化电子邮箱(大写)"), - EmailConfirmed = table.Column(type: "boolean", nullable: false, comment: "邮箱是否已验证"), - PasswordHash = table.Column(type: "text", nullable: true, comment: "密码哈希值"), - SecurityStamp = table.Column(type: "text", nullable: true, comment: "安全戳,用于并发控制"), - ConcurrencyStamp = table.Column(type: "text", nullable: true, comment: "并发控制戳"), - PhoneNumber = table.Column(type: "text", nullable: false, comment: "电话号码"), - PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false, comment: "电话号码是否已验证"), - TwoFactorEnabled = table.Column(type: "boolean", nullable: false, comment: "是否启用双因素认证"), - LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true, comment: "账户锁定结束时间"), - LockoutEnabled = table.Column(type: "boolean", nullable: false, comment: "是否启用账户锁定"), - AccessFailedCount = table.Column(type: "integer", nullable: false, comment: "登录失败次数") - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }, - comment: "用户表"); - - migrationBuilder.CreateTable( - name: "RolePermissions", - columns: table => new - { - RoleId = table.Column(type: "text", nullable: false), - PermissionId = table.Column(type: "text", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_RolePermissions", x => new { x.RoleId, x.PermissionId }); - table.ForeignKey( - name: "FK_RolePermissions_Permissions_PermissionId", - column: x => x.PermissionId, - principalTable: "Permissions", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_RolePermissions_Roles_RoleId", - column: x => x.RoleId, - principalTable: "Roles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "UserRoles", - columns: table => new - { - UserId = table.Column(type: "text", nullable: false), - RoleId = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_UserRoles_Roles_RoleId", - column: x => x.RoleId, - principalTable: "Roles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_UserRoles_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }, - comment: "用户角色关系表"); - - migrationBuilder.CreateIndex( - name: "IX_RolePermissions_PermissionId", - table: "RolePermissions", - column: "PermissionId"); - - migrationBuilder.CreateIndex( - name: "IX_Roles_Name", - table: "Roles", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "Roles", - column: "NormalizedName", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_UserRoles_RoleId", - table: "UserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "Users", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "IX_Users_Email", - table: "Users", - column: "Email", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Users_PhoneNumber", - table: "Users", - column: "PhoneNumber", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Users_UserName", - table: "Users", - column: "UserName", - unique: true); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "Users", - column: "NormalizedUserName", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "RolePermissions"); - - migrationBuilder.DropTable( - name: "UserRoles"); - - migrationBuilder.DropTable( - name: "Permissions"); - - migrationBuilder.DropTable( - name: "Roles"); - - migrationBuilder.DropTable( - name: "Users"); - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250516021320_AddRoleTimestamps.Designer.cs b/src/CellularManagement.Infrastructure/Migrations/20250516021320_AddRoleTimestamps.Designer.cs deleted file mode 100644 index e806b4e..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250516021320_AddRoleTimestamps.Designer.cs +++ /dev/null @@ -1,290 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250516021320_AddRoleTimestamps")] - partial class AddRoleTimestamps - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化用户名(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("用户名"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.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.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250516021320_AddRoleTimestamps.cs b/src/CellularManagement.Infrastructure/Migrations/20250516021320_AddRoleTimestamps.cs deleted file mode 100644 index 20458d1..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250516021320_AddRoleTimestamps.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - /// - public partial class AddRoleTimestamps : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CreatedAt", - table: "Roles", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - comment: "创建时间"); - - migrationBuilder.AddColumn( - name: "UpdatedAt", - table: "Roles", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - comment: "更新时间"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CreatedAt", - table: "Roles"); - - migrationBuilder.DropColumn( - name: "UpdatedAt", - table: "Roles"); - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250519092205_AddAuditFieldsToAppUser.Designer.cs b/src/CellularManagement.Infrastructure/Migrations/20250519092205_AddAuditFieldsToAppUser.Designer.cs deleted file mode 100644 index bfde0b5..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250519092205_AddAuditFieldsToAppUser.Designer.cs +++ /dev/null @@ -1,310 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250519092205_AddAuditFieldsToAppUser")] - partial class AddAuditFieldsToAppUser - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true) - .HasComment("用户状态(true: 启用, false: 禁用)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasComment("是否已删除"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("ModifiedTime") - .HasColumnType("timestamp with time zone") - .HasComment("修改时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化用户名(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("用户名"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.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.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250519092205_AddAuditFieldsToAppUser.cs b/src/CellularManagement.Infrastructure/Migrations/20250519092205_AddAuditFieldsToAppUser.cs deleted file mode 100644 index f8fabbb..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250519092205_AddAuditFieldsToAppUser.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - /// - public partial class AddAuditFieldsToAppUser : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CreatedTime", - table: "Users", - type: "timestamp with time zone", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - comment: "创建时间"); - - migrationBuilder.AddColumn( - name: "IsActive", - table: "Users", - type: "boolean", - nullable: false, - defaultValue: true, - comment: "用户状态(true: 启用, false: 禁用)"); - - migrationBuilder.AddColumn( - name: "IsDeleted", - table: "Users", - type: "boolean", - nullable: false, - defaultValue: false, - comment: "是否已删除"); - - migrationBuilder.AddColumn( - name: "ModifiedTime", - table: "Users", - type: "timestamp with time zone", - nullable: true, - comment: "修改时间"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CreatedTime", - table: "Users"); - - migrationBuilder.DropColumn( - name: "IsActive", - table: "Users"); - - migrationBuilder.DropColumn( - name: "IsDeleted", - table: "Users"); - - migrationBuilder.DropColumn( - name: "ModifiedTime", - table: "Users"); - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250519093405_RemoveDuplicateAuditFields.Designer.cs b/src/CellularManagement.Infrastructure/Migrations/20250519093405_RemoveDuplicateAuditFields.Designer.cs deleted file mode 100644 index 229c4e2..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250519093405_RemoveDuplicateAuditFields.Designer.cs +++ /dev/null @@ -1,310 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250519093405_RemoveDuplicateAuditFields")] - partial class RemoveDuplicateAuditFields - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true) - .HasComment("用户状态(true: 启用, false: 禁用)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasComment("是否已删除"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("ModifiedTime") - .HasColumnType("timestamp with time zone") - .HasComment("修改时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化用户名(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("用户名"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.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.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250519093405_RemoveDuplicateAuditFields.cs b/src/CellularManagement.Infrastructure/Migrations/20250519093405_RemoveDuplicateAuditFields.cs deleted file mode 100644 index 878299b..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250519093405_RemoveDuplicateAuditFields.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - /// - public partial class RemoveDuplicateAuditFields : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250519093919_UpdateAppUserAuditFields.Designer.cs b/src/CellularManagement.Infrastructure/Migrations/20250519093919_UpdateAppUserAuditFields.Designer.cs deleted file mode 100644 index 458c16b..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250519093919_UpdateAppUserAuditFields.Designer.cs +++ /dev/null @@ -1,310 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250519093919_UpdateAppUserAuditFields")] - partial class UpdateAppUserAuditFields - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true) - .HasComment("用户状态(true: 启用, false: 禁用)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasComment("是否已删除"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("ModifiedTime") - .HasColumnType("timestamp with time zone") - .HasComment("修改时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化用户名(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("用户名"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.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.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250519093919_UpdateAppUserAuditFields.cs b/src/CellularManagement.Infrastructure/Migrations/20250519093919_UpdateAppUserAuditFields.cs deleted file mode 100644 index be21886..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250519093919_UpdateAppUserAuditFields.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - /// - public partial class UpdateAppUserAuditFields : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250520034505_AddLastLoginTime.Designer.cs b/src/CellularManagement.Infrastructure/Migrations/20250520034505_AddLastLoginTime.Designer.cs deleted file mode 100644 index dbc68a8..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250520034505_AddLastLoginTime.Designer.cs +++ /dev/null @@ -1,314 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250520034505_AddLastLoginTime")] - partial class AddLastLoginTime - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true) - .HasComment("用户状态(true: 启用, false: 禁用)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasComment("是否已删除"); - - b.Property("LastLoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("最后登录时间"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("ModifiedTime") - .HasColumnType("timestamp with time zone") - .HasComment("修改时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化用户名(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("用户名"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.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.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250520034505_AddLastLoginTime.cs b/src/CellularManagement.Infrastructure/Migrations/20250520034505_AddLastLoginTime.cs deleted file mode 100644 index fec1fd4..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250520034505_AddLastLoginTime.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - /// - public partial class AddLastLoginTime : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "LastLoginTime", - table: "Users", - type: "timestamp with time zone", - nullable: true, - comment: "最后登录时间"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "LastLoginTime", - table: "Users"); - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250520044439_AddLoginLog.Designer.cs b/src/CellularManagement.Infrastructure/Migrations/20250520044439_AddLoginLog.Designer.cs deleted file mode 100644 index e34b0c5..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250520044439_AddLoginLog.Designer.cs +++ /dev/null @@ -1,396 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250520044439_AddLoginLog")] - partial class AddLoginLog - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true) - .HasComment("用户状态(true: 启用, false: 禁用)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasComment("是否已删除"); - - b.Property("LastLoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("最后登录时间"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("ModifiedTime") - .HasColumnType("timestamp with time zone") - .HasComment("修改时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化用户名(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("用户名"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.LoginLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasComment("日志ID"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("浏览器信息"); - - b.Property("FailureReason") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("失败原因"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("登录IP"); - - b.Property("IsSuccess") - .HasColumnType("boolean") - .HasComment("登录状态(成功/失败)"); - - b.Property("Location") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("登录位置"); - - b.Property("LoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("登录时间"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("操作系统信息"); - - b.Property("UserAgent") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("设备信息"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("character varying(450)") - .HasComment("用户ID"); - - b.HasKey("Id"); - - b.HasIndex("IpAddress") - .HasDatabaseName("IX_LoginLogs_IpAddress"); - - b.HasIndex("LoginTime") - .HasDatabaseName("IX_LoginLogs_LoginTime"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_LoginLogs_UserId"); - - b.HasIndex("UserId", "LoginTime") - .HasDatabaseName("IX_LoginLogs_UserId_LoginTime"); - - b.ToTable("LoginLogs", null, t => - { - t.HasComment("用户登录日志表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.LoginLog", b => - { - b.HasOne("CellularManagement.Domain.Entities.AppUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - 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.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250520044439_AddLoginLog.cs b/src/CellularManagement.Infrastructure/Migrations/20250520044439_AddLoginLog.cs deleted file mode 100644 index 8ba7093..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250520044439_AddLoginLog.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - /// - public partial class AddLoginLog : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "LoginLogs", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false, comment: "日志ID"), - UserId = table.Column(type: "character varying(450)", maxLength: 450, nullable: false, comment: "用户ID"), - LoginTime = table.Column(type: "timestamp with time zone", nullable: false, comment: "登录时间"), - IpAddress = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "登录IP"), - UserAgent = table.Column(type: "character varying(500)", maxLength: 500, nullable: false, comment: "设备信息"), - IsSuccess = table.Column(type: "boolean", nullable: false, comment: "登录状态(成功/失败)"), - FailureReason = table.Column(type: "character varying(200)", maxLength: 200, nullable: true, comment: "失败原因"), - Location = table.Column(type: "character varying(200)", maxLength: 200, nullable: true, comment: "登录位置"), - Browser = table.Column(type: "character varying(100)", maxLength: 100, nullable: true, comment: "浏览器信息"), - OperatingSystem = table.Column(type: "character varying(100)", maxLength: 100, nullable: true, comment: "操作系统信息") - }, - constraints: table => - { - table.PrimaryKey("PK_LoginLogs", x => x.Id); - table.ForeignKey( - name: "FK_LoginLogs_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }, - comment: "用户登录日志表"); - - migrationBuilder.CreateIndex( - name: "IX_LoginLogs_IpAddress", - table: "LoginLogs", - column: "IpAddress"); - - migrationBuilder.CreateIndex( - name: "IX_LoginLogs_LoginTime", - table: "LoginLogs", - column: "LoginTime"); - - migrationBuilder.CreateIndex( - name: "IX_LoginLogs_UserId", - table: "LoginLogs", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_LoginLogs_UserId_LoginTime", - table: "LoginLogs", - columns: new[] { "UserId", "LoginTime" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "LoginLogs"); - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250520060054_AddRealNameToAppUser.Designer.cs b/src/CellularManagement.Infrastructure/Migrations/20250520060054_AddRealNameToAppUser.Designer.cs deleted file mode 100644 index f25def3..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250520060054_AddRealNameToAppUser.Designer.cs +++ /dev/null @@ -1,401 +0,0 @@ -// -using System; -using CellularManagement.Infrastructure.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20250520060054_AddRealNameToAppUser")] - partial class AddRealNameToAppUser - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("角色ID,主键"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("角色描述"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("角色名称"); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化角色名称(大写)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone") - .HasComment("更新时间"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_Roles_Name"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", null, t => - { - t.HasComment("角色表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.AppUser", b => - { - b.Property("Id") - .HasColumnType("text") - .HasComment("用户ID,主键"); - - b.Property("AccessFailedCount") - .HasColumnType("integer") - .HasComment("登录失败次数"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text") - .HasComment("并发控制戳"); - - b.Property("CreatedTime") - .HasColumnType("timestamp with time zone") - .HasComment("创建时间"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("电子邮箱"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean") - .HasComment("邮箱是否已验证"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true) - .HasComment("用户状态(true: 启用, false: 禁用)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasComment("是否已删除"); - - b.Property("LastLoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("最后登录时间"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean") - .HasComment("是否启用账户锁定"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone") - .HasComment("账户锁定结束时间"); - - b.Property("ModifiedTime") - .HasColumnType("timestamp with time zone") - .HasComment("修改时间"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化电子邮箱(大写)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("标准化用户名(大写)"); - - b.Property("PasswordHash") - .HasColumnType("text") - .HasComment("密码哈希值"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("text") - .HasComment("电话号码"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean") - .HasComment("电话号码是否已验证"); - - b.Property("RealName") - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("真实姓名"); - - b.Property("SecurityStamp") - .HasColumnType("text") - .HasComment("安全戳,用于并发控制"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean") - .HasComment("是否启用双因素认证"); - - b.Property("UserName") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("character varying(256)") - .HasComment("用户名"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_Users_Email"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.HasIndex("PhoneNumber") - .IsUnique() - .HasDatabaseName("IX_Users_PhoneNumber"); - - b.HasIndex("UserName") - .IsUnique() - .HasDatabaseName("IX_Users_UserName"); - - b.ToTable("Users", null, t => - { - t.HasComment("用户表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.LoginLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") - .HasComment("日志ID"); - - b.Property("Browser") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("浏览器信息"); - - b.Property("FailureReason") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("失败原因"); - - b.Property("IpAddress") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)") - .HasComment("登录IP"); - - b.Property("IsSuccess") - .HasColumnType("boolean") - .HasComment("登录状态(成功/失败)"); - - b.Property("Location") - .HasMaxLength(200) - .HasColumnType("character varying(200)") - .HasComment("登录位置"); - - b.Property("LoginTime") - .HasColumnType("timestamp with time zone") - .HasComment("登录时间"); - - b.Property("OperatingSystem") - .HasMaxLength(100) - .HasColumnType("character varying(100)") - .HasComment("操作系统信息"); - - b.Property("UserAgent") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)") - .HasComment("设备信息"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("character varying(450)") - .HasComment("用户ID"); - - b.HasKey("Id"); - - b.HasIndex("IpAddress") - .HasDatabaseName("IX_LoginLogs_IpAddress"); - - b.HasIndex("LoginTime") - .HasDatabaseName("IX_LoginLogs_LoginTime"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_LoginLogs_UserId"); - - b.HasIndex("UserId", "LoginTime") - .HasDatabaseName("IX_LoginLogs_UserId_LoginTime"); - - b.ToTable("LoginLogs", null, t => - { - t.HasComment("用户登录日志表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.Permission", b => - { - b.Property("Id") - .HasColumnType("text"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("Id"); - - b.ToTable("Permissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("text"); - - b.Property("PermissionId") - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("RolePermissions", (string)null); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("text"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", null, t => - { - t.HasComment("用户角色关系表"); - }); - }); - - modelBuilder.Entity("CellularManagement.Domain.Entities.LoginLog", b => - { - b.HasOne("CellularManagement.Domain.Entities.AppUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - 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.Permission", b => - { - b.Navigation("RolePermissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250520060054_AddRealNameToAppUser.cs b/src/CellularManagement.Infrastructure/Migrations/20250520060054_AddRealNameToAppUser.cs deleted file mode 100644 index 0e9edf7..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250520060054_AddRealNameToAppUser.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - /// - public partial class AddRealNameToAppUser : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "RealName", - table: "Users", - type: "character varying(50)", - maxLength: 50, - nullable: true, - comment: "真实姓名"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "RealName", - table: "Users"); - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250520060351_UpdateUserComments.cs b/src/CellularManagement.Infrastructure/Migrations/20250520060351_UpdateUserComments.cs deleted file mode 100644 index 1188a8b..0000000 --- a/src/CellularManagement.Infrastructure/Migrations/20250520060351_UpdateUserComments.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CellularManagement.Infrastructure.Migrations -{ - /// - public partial class UpdateUserComments : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "UserName", - table: "Users", - type: "character varying(256)", - maxLength: 256, - nullable: false, - comment: "账号", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldComment: "用户名"); - - migrationBuilder.AlterColumn( - name: "RealName", - table: "Users", - type: "character varying(50)", - maxLength: 50, - nullable: true, - comment: "用户名", - oldClrType: typeof(string), - oldType: "character varying(50)", - oldMaxLength: 50, - oldNullable: true, - oldComment: "真实姓名"); - - migrationBuilder.AlterColumn( - name: "NormalizedUserName", - table: "Users", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "标准化账号(大写)", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "标准化用户名(大写)"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "UserName", - table: "Users", - type: "character varying(256)", - maxLength: 256, - nullable: false, - comment: "用户名", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldComment: "账号"); - - migrationBuilder.AlterColumn( - name: "RealName", - table: "Users", - type: "character varying(50)", - maxLength: 50, - nullable: true, - comment: "真实姓名", - oldClrType: typeof(string), - oldType: "character varying(50)", - oldMaxLength: 50, - oldNullable: true, - oldComment: "用户名"); - - migrationBuilder.AlterColumn( - name: "NormalizedUserName", - table: "Users", - type: "character varying(256)", - maxLength: 256, - nullable: true, - comment: "标准化用户名(大写)", - oldClrType: typeof(string), - oldType: "character varying(256)", - oldMaxLength: 256, - oldNullable: true, - oldComment: "标准化账号(大写)"); - } - } -} diff --git a/src/CellularManagement.Infrastructure/Migrations/20250520060351_UpdateUserComments.Designer.cs b/src/CellularManagement.Infrastructure/Migrations/20250606094331_InitialCreate.Designer.cs similarity index 54% rename from src/CellularManagement.Infrastructure/Migrations/20250520060351_UpdateUserComments.Designer.cs rename to src/CellularManagement.Infrastructure/Migrations/20250606094331_InitialCreate.Designer.cs index 3e04971..726f319 100644 --- a/src/CellularManagement.Infrastructure/Migrations/20250520060351_UpdateUserComments.Designer.cs +++ b/src/CellularManagement.Infrastructure/Migrations/20250606094331_InitialCreate.Designer.cs @@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace CellularManagement.Infrastructure.Migrations { [DbContext(typeof(AppDbContext))] - [Migration("20250520060351_UpdateUserComments")] - partial class UpdateUserComments + [Migration("20250606094331_InitialCreate")] + partial class InitialCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -203,11 +203,282 @@ namespace CellularManagement.Infrastructure.Migrations }); }); - modelBuilder.Entity("CellularManagement.Domain.Entities.LoginLog", b => + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") + b.Property("Id") + .HasColumnType("text") + .HasComment("设备ID"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("创建时间"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasComment("设备描述"); + + b.Property("DeviceTypeId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("设备类型ID"); + + b.Property("FirmwareVersion") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("固件版本"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasComment("设备名称"); + + b.Property("ProtocolVersionId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("协议版本ID"); + + b.Property("SerialNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("序列号"); + + b.Property("StatusId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("设备状态ID"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("更新时间"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DeviceTypeId") + .HasDatabaseName("IX_CellularDevices_DeviceTypeId"); + + b.HasIndex("ProtocolVersionId") + .HasDatabaseName("IX_CellularDevices_ProtocolVersionId"); + + b.HasIndex("SerialNumber") + .IsUnique() + .HasDatabaseName("IX_CellularDevices_SerialNumber"); + + b.HasIndex("StatusId") + .HasDatabaseName("IX_CellularDevices_StatusId"); + + b.ToTable("CellularDevices", null, t => + { + t.HasComment("蜂窝设备表"); + }); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.DeviceStatus", b => + { + b.Property("Id") + .HasColumnType("text") + .HasComment("状态ID"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("Color") + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("创建时间"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasComment("状态描述"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("状态名称"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .IsRequired() + .HasColumnType("timestamp with time zone") + .HasComment("更新时间"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DeviceStatuses", null, t => + { + t.HasComment("设备状态表"); + }); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.DeviceType", b => + { + b.Property("Id") + .HasColumnType("text") + .HasComment("类型ID"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("创建时间"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasComment("类型描述"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("类型名称"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .IsRequired() + .HasColumnType("timestamp with time zone") + .HasComment("更新时间"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DeviceTypes", null, t => + { + t.HasComment("设备类型表"); + }); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => + { + b.Property("Id") + .HasColumnType("text") + .HasComment("版本ID"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("创建时间"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasComment("版本描述"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("IsForceUpdate") + .HasColumnType("boolean"); + + b.Property("MinimumSupportedVersion") + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ProtocolType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ReleaseDate") + .HasColumnType("timestamp with time zone"); + + b.Property("UpdatedAt") + .IsRequired() + .HasColumnType("timestamp with time zone") + .HasComment("更新时间"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("版本号"); + + b.HasKey("Id"); + + b.HasIndex("Version") + .IsUnique() + .HasDatabaseName("IX_ProtocolVersions_Version"); + + b.ToTable("ProtocolVersions", null, t => + { + t.HasComment("协议版本表"); + }); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => + { + b.Property("Id") + .HasColumnType("text") .HasComment("日志ID"); b.Property("Browser") @@ -215,6 +486,9 @@ namespace CellularManagement.Infrastructure.Migrations .HasColumnType("character varying(100)") .HasComment("浏览器信息"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + b.Property("FailureReason") .HasMaxLength(200) .HasColumnType("character varying(200)") @@ -226,6 +500,9 @@ namespace CellularManagement.Infrastructure.Migrations .HasColumnType("character varying(50)") .HasComment("登录IP"); + b.Property("IsDeleted") + .HasColumnType("boolean"); + b.Property("IsSuccess") .HasColumnType("boolean") .HasComment("登录状态(成功/失败)"); @@ -235,15 +512,32 @@ namespace CellularManagement.Infrastructure.Migrations .HasColumnType("character varying(200)") .HasComment("登录位置"); + b.Property("LoginSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + b.Property("LoginTime") .HasColumnType("timestamp with time zone") .HasComment("登录时间"); + b.Property("LoginType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + b.Property("OperatingSystem") .HasMaxLength(100) .HasColumnType("character varying(100)") .HasComment("操作系统信息"); + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + b.Property("UserAgent") .IsRequired() .HasMaxLength(500) @@ -344,7 +638,34 @@ namespace CellularManagement.Infrastructure.Migrations }); }); - modelBuilder.Entity("CellularManagement.Domain.Entities.LoginLog", b => + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => + { + b.HasOne("CellularManagement.Domain.Entities.Device.DeviceType", "DeviceType") + .WithMany() + .HasForeignKey("DeviceTypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("CellularManagement.Domain.Entities.Device.ProtocolVersion", "ProtocolVersion") + .WithMany() + .HasForeignKey("ProtocolVersionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("CellularManagement.Domain.Entities.Device.DeviceStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DeviceType"); + + b.Navigation("ProtocolVersion"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => { b.HasOne("CellularManagement.Domain.Entities.AppUser", null) .WithMany() diff --git a/src/CellularManagement.Infrastructure/Migrations/20250606094331_InitialCreate.cs b/src/CellularManagement.Infrastructure/Migrations/20250606094331_InitialCreate.cs new file mode 100644 index 0000000..8a20569 --- /dev/null +++ b/src/CellularManagement.Infrastructure/Migrations/20250606094331_InitialCreate.cs @@ -0,0 +1,408 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CellularManagement.Infrastructure.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "DeviceStatuses", + columns: table => new + { + Id = table.Column(type: "text", nullable: false, comment: "状态ID"), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "状态名称"), + Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), + Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: true, comment: "状态描述"), + Color = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), + IsEnabled = table.Column(type: "boolean", nullable: false), + SortOrder = table.Column(type: "integer", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "更新时间"), + IsDeleted = table.Column(type: "boolean", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + UpdatedBy = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DeviceStatuses", x => x.Id); + }, + comment: "设备状态表"); + + migrationBuilder.CreateTable( + name: "DeviceTypes", + columns: table => new + { + Id = table.Column(type: "text", nullable: false, comment: "类型ID"), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "类型名称"), + Code = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), + Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: true, comment: "类型描述"), + IsEnabled = table.Column(type: "boolean", nullable: false), + SortOrder = table.Column(type: "integer", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "更新时间"), + IsDeleted = table.Column(type: "boolean", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + UpdatedBy = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DeviceTypes", x => x.Id); + }, + comment: "设备类型表"); + + migrationBuilder.CreateTable( + name: "Permissions", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + Code = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + Type = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Permissions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ProtocolVersions", + columns: table => new + { + Id = table.Column(type: "text", nullable: false, comment: "版本ID"), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + Version = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "版本号"), + ProtocolType = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: true, comment: "版本描述"), + IsEnabled = table.Column(type: "boolean", nullable: false), + ReleaseDate = table.Column(type: "timestamp with time zone", nullable: true), + IsForceUpdate = table.Column(type: "boolean", nullable: false), + MinimumSupportedVersion = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "更新时间"), + IsDeleted = table.Column(type: "boolean", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + UpdatedBy = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ProtocolVersions", x => x.Id); + }, + comment: "协议版本表"); + + migrationBuilder.CreateTable( + name: "Roles", + columns: table => new + { + Id = table.Column(type: "text", nullable: false, comment: "角色ID,主键"), + Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true, comment: "角色描述"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "更新时间"), + Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "角色名称"), + NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "标准化角色名称(大写)"), + ConcurrencyStamp = table.Column(type: "text", nullable: true, comment: "并发控制戳") + }, + constraints: table => + { + table.PrimaryKey("PK_Roles", x => x.Id); + }, + comment: "角色表"); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(type: "text", nullable: false, comment: "用户ID,主键"), + IsActive = table.Column(type: "boolean", nullable: false, defaultValue: true, comment: "用户状态(true: 启用, false: 禁用)"), + IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false, comment: "是否已删除"), + LastLoginTime = table.Column(type: "timestamp with time zone", nullable: true, comment: "最后登录时间"), + RealName = table.Column(type: "character varying(50)", maxLength: 50, nullable: true, comment: "用户名"), + UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "账号"), + NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "标准化账号(大写)"), + Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: false, comment: "电子邮箱"), + NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true, comment: "标准化电子邮箱(大写)"), + EmailConfirmed = table.Column(type: "boolean", nullable: false, comment: "邮箱是否已验证"), + PasswordHash = table.Column(type: "text", nullable: true, comment: "密码哈希值"), + SecurityStamp = table.Column(type: "text", nullable: true, comment: "安全戳,用于并发控制"), + ConcurrencyStamp = table.Column(type: "text", nullable: true, comment: "并发控制戳"), + PhoneNumber = table.Column(type: "text", nullable: false, comment: "电话号码"), + PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false, comment: "电话号码是否已验证"), + TwoFactorEnabled = table.Column(type: "boolean", nullable: false, comment: "是否启用双因素认证"), + LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true, comment: "账户锁定结束时间"), + LockoutEnabled = table.Column(type: "boolean", nullable: false, comment: "是否启用账户锁定"), + AccessFailedCount = table.Column(type: "integer", nullable: false, comment: "登录失败次数"), + CreatedTime = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间"), + ModifiedTime = table.Column(type: "timestamp with time zone", nullable: true, comment: "修改时间") + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + }, + comment: "用户表"); + + migrationBuilder.CreateTable( + name: "CellularDevices", + columns: table => new + { + Id = table.Column(type: "text", nullable: false, comment: "设备ID"), + Name = table.Column(type: "character varying(100)", maxLength: 100, nullable: false, comment: "设备名称"), + SerialNumber = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "序列号"), + Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: false, comment: "设备描述"), + DeviceTypeId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "设备类型ID"), + StatusId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "设备状态ID"), + ProtocolVersionId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "协议版本ID"), + FirmwareVersion = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "固件版本"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "创建时间"), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false, comment: "更新时间"), + IsDeleted = table.Column(type: "boolean", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + UpdatedBy = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CellularDevices", x => x.Id); + table.ForeignKey( + name: "FK_CellularDevices_DeviceStatuses_StatusId", + column: x => x.StatusId, + principalTable: "DeviceStatuses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CellularDevices_DeviceTypes_DeviceTypeId", + column: x => x.DeviceTypeId, + principalTable: "DeviceTypes", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CellularDevices_ProtocolVersions_ProtocolVersionId", + column: x => x.ProtocolVersionId, + principalTable: "ProtocolVersions", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }, + comment: "蜂窝设备表"); + + migrationBuilder.CreateTable( + name: "RolePermissions", + columns: table => new + { + RoleId = table.Column(type: "text", nullable: false), + PermissionId = table.Column(type: "text", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RolePermissions", x => new { x.RoleId, x.PermissionId }); + table.ForeignKey( + name: "FK_RolePermissions_Permissions_PermissionId", + column: x => x.PermissionId, + principalTable: "Permissions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_RolePermissions_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LoginLogs", + columns: table => new + { + Id = table.Column(type: "text", nullable: false, comment: "日志ID"), + UserId = table.Column(type: "character varying(450)", maxLength: 450, nullable: false, comment: "用户ID"), + LoginTime = table.Column(type: "timestamp with time zone", nullable: false, comment: "登录时间"), + IpAddress = table.Column(type: "character varying(50)", maxLength: 50, nullable: false, comment: "登录IP"), + UserAgent = table.Column(type: "character varying(500)", maxLength: 500, nullable: false, comment: "设备信息"), + IsSuccess = table.Column(type: "boolean", nullable: false, comment: "登录状态(成功/失败)"), + FailureReason = table.Column(type: "character varying(200)", maxLength: 200, nullable: true, comment: "失败原因"), + Location = table.Column(type: "character varying(200)", maxLength: 200, nullable: true, comment: "登录位置"), + Browser = table.Column(type: "character varying(100)", maxLength: 100, nullable: true, comment: "浏览器信息"), + OperatingSystem = table.Column(type: "character varying(100)", maxLength: 100, nullable: true, comment: "操作系统信息"), + LoginType = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + LoginSource = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + SessionId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LoginLogs", x => x.Id); + table.ForeignKey( + name: "FK_LoginLogs_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }, + comment: "用户登录日志表"); + + migrationBuilder.CreateTable( + name: "UserRoles", + columns: table => new + { + UserId = table.Column(type: "text", nullable: false), + RoleId = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_UserRoles_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_UserRoles_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "用户角色关系表"); + + migrationBuilder.CreateIndex( + name: "IX_CellularDevices_DeviceTypeId", + table: "CellularDevices", + column: "DeviceTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_CellularDevices_ProtocolVersionId", + table: "CellularDevices", + column: "ProtocolVersionId"); + + migrationBuilder.CreateIndex( + name: "IX_CellularDevices_SerialNumber", + table: "CellularDevices", + column: "SerialNumber", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_CellularDevices_StatusId", + table: "CellularDevices", + column: "StatusId"); + + migrationBuilder.CreateIndex( + name: "IX_LoginLogs_IpAddress", + table: "LoginLogs", + column: "IpAddress"); + + migrationBuilder.CreateIndex( + name: "IX_LoginLogs_LoginTime", + table: "LoginLogs", + column: "LoginTime"); + + migrationBuilder.CreateIndex( + name: "IX_LoginLogs_UserId", + table: "LoginLogs", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_LoginLogs_UserId_LoginTime", + table: "LoginLogs", + columns: new[] { "UserId", "LoginTime" }); + + migrationBuilder.CreateIndex( + name: "IX_ProtocolVersions_Version", + table: "ProtocolVersions", + column: "Version", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_RolePermissions_PermissionId", + table: "RolePermissions", + column: "PermissionId"); + + migrationBuilder.CreateIndex( + name: "IX_Roles_Name", + table: "Roles", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "Roles", + column: "NormalizedName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_UserRoles_RoleId", + table: "UserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "Users", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "IX_Users_Email", + table: "Users", + column: "Email", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Users_PhoneNumber", + table: "Users", + column: "PhoneNumber", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Users_UserName", + table: "Users", + column: "UserName", + unique: true); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "Users", + column: "NormalizedUserName", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CellularDevices"); + + migrationBuilder.DropTable( + name: "LoginLogs"); + + migrationBuilder.DropTable( + name: "RolePermissions"); + + migrationBuilder.DropTable( + name: "UserRoles"); + + migrationBuilder.DropTable( + name: "DeviceStatuses"); + + migrationBuilder.DropTable( + name: "DeviceTypes"); + + migrationBuilder.DropTable( + name: "ProtocolVersions"); + + migrationBuilder.DropTable( + name: "Permissions"); + + migrationBuilder.DropTable( + name: "Roles"); + + migrationBuilder.DropTable( + name: "Users"); + } + } +} diff --git a/src/CellularManagement.Infrastructure/Migrations/AppDbContextModelSnapshot.cs b/src/CellularManagement.Infrastructure/Migrations/AppDbContextModelSnapshot.cs index d2cb8c9..7bb9ffd 100644 --- a/src/CellularManagement.Infrastructure/Migrations/AppDbContextModelSnapshot.cs +++ b/src/CellularManagement.Infrastructure/Migrations/AppDbContextModelSnapshot.cs @@ -200,11 +200,282 @@ namespace CellularManagement.Infrastructure.Migrations }); }); - modelBuilder.Entity("CellularManagement.Domain.Entities.LoginLog", b => + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid") + b.Property("Id") + .HasColumnType("text") + .HasComment("设备ID"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("创建时间"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("character varying(500)") + .HasComment("设备描述"); + + b.Property("DeviceTypeId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("设备类型ID"); + + b.Property("FirmwareVersion") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("固件版本"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)") + .HasComment("设备名称"); + + b.Property("ProtocolVersionId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("协议版本ID"); + + b.Property("SerialNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("序列号"); + + b.Property("StatusId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("设备状态ID"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("更新时间"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DeviceTypeId") + .HasDatabaseName("IX_CellularDevices_DeviceTypeId"); + + b.HasIndex("ProtocolVersionId") + .HasDatabaseName("IX_CellularDevices_ProtocolVersionId"); + + b.HasIndex("SerialNumber") + .IsUnique() + .HasDatabaseName("IX_CellularDevices_SerialNumber"); + + b.HasIndex("StatusId") + .HasDatabaseName("IX_CellularDevices_StatusId"); + + b.ToTable("CellularDevices", null, t => + { + t.HasComment("蜂窝设备表"); + }); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.DeviceStatus", b => + { + b.Property("Id") + .HasColumnType("text") + .HasComment("状态ID"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("Color") + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("创建时间"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasComment("状态描述"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("状态名称"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .IsRequired() + .HasColumnType("timestamp with time zone") + .HasComment("更新时间"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DeviceStatuses", null, t => + { + t.HasComment("设备状态表"); + }); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.DeviceType", b => + { + b.Property("Id") + .HasColumnType("text") + .HasComment("类型ID"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("创建时间"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasComment("类型描述"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("类型名称"); + + b.Property("SortOrder") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .IsRequired() + .HasColumnType("timestamp with time zone") + .HasComment("更新时间"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DeviceTypes", null, t => + { + t.HasComment("设备类型表"); + }); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.ProtocolVersion", b => + { + b.Property("Id") + .HasColumnType("text") + .HasComment("版本ID"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasComment("创建时间"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)") + .HasComment("版本描述"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("IsForceUpdate") + .HasColumnType("boolean"); + + b.Property("MinimumSupportedVersion") + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ProtocolType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ReleaseDate") + .HasColumnType("timestamp with time zone"); + + b.Property("UpdatedAt") + .IsRequired() + .HasColumnType("timestamp with time zone") + .HasComment("更新时间"); + + b.Property("UpdatedBy") + .HasColumnType("text"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasComment("版本号"); + + b.HasKey("Id"); + + b.HasIndex("Version") + .IsUnique() + .HasDatabaseName("IX_ProtocolVersions_Version"); + + b.ToTable("ProtocolVersions", null, t => + { + t.HasComment("协议版本表"); + }); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => + { + b.Property("Id") + .HasColumnType("text") .HasComment("日志ID"); b.Property("Browser") @@ -212,6 +483,9 @@ namespace CellularManagement.Infrastructure.Migrations .HasColumnType("character varying(100)") .HasComment("浏览器信息"); + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + b.Property("FailureReason") .HasMaxLength(200) .HasColumnType("character varying(200)") @@ -223,6 +497,9 @@ namespace CellularManagement.Infrastructure.Migrations .HasColumnType("character varying(50)") .HasComment("登录IP"); + b.Property("IsDeleted") + .HasColumnType("boolean"); + b.Property("IsSuccess") .HasColumnType("boolean") .HasComment("登录状态(成功/失败)"); @@ -232,15 +509,32 @@ namespace CellularManagement.Infrastructure.Migrations .HasColumnType("character varying(200)") .HasComment("登录位置"); + b.Property("LoginSource") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + b.Property("LoginTime") .HasColumnType("timestamp with time zone") .HasComment("登录时间"); + b.Property("LoginType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + b.Property("OperatingSystem") .HasMaxLength(100) .HasColumnType("character varying(100)") .HasComment("操作系统信息"); + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + b.Property("UserAgent") .IsRequired() .HasMaxLength(500) @@ -341,7 +635,34 @@ namespace CellularManagement.Infrastructure.Migrations }); }); - modelBuilder.Entity("CellularManagement.Domain.Entities.LoginLog", b => + modelBuilder.Entity("CellularManagement.Domain.Entities.Device.CellularDevice", b => + { + b.HasOne("CellularManagement.Domain.Entities.Device.DeviceType", "DeviceType") + .WithMany() + .HasForeignKey("DeviceTypeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("CellularManagement.Domain.Entities.Device.ProtocolVersion", "ProtocolVersion") + .WithMany() + .HasForeignKey("ProtocolVersionId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("CellularManagement.Domain.Entities.Device.DeviceStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("DeviceType"); + + b.Navigation("ProtocolVersion"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("CellularManagement.Domain.Entities.Logging.LoginLog", b => { b.HasOne("CellularManagement.Domain.Entities.AppUser", null) .WithMany()