8 changed files with 185 additions and 239 deletions
@ -1,203 +0,0 @@ |
|||||
// <auto-generated />
|
|
||||
using System; |
|
||||
using CellularManagement.Infrastructure.Context; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace CellularManagement.Infrastructure.Migrations |
|
||||
{ |
|
||||
[DbContext(typeof(AppDbContext))] |
|
||||
[Migration("20250429070845_InitialCreate")] |
|
||||
partial class InitialCreate |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|
||||
{ |
|
||||
#pragma warning disable 612, 618
|
|
||||
modelBuilder |
|
||||
.HasAnnotation("ProductVersion", "8.0.0") |
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63); |
|
||||
|
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); |
|
||||
|
|
||||
modelBuilder.Entity("CellularManagement.Domain.Entities.AppRole", b => |
|
||||
{ |
|
||||
b.Property<string>("Id") |
|
||||
.HasColumnType("text") |
|
||||
.HasComment("角色ID,主键"); |
|
||||
|
|
||||
b.Property<string>("ConcurrencyStamp") |
|
||||
.IsConcurrencyToken() |
|
||||
.HasColumnType("text") |
|
||||
.HasComment("并发控制戳"); |
|
||||
|
|
||||
b.Property<string>("Name") |
|
||||
.IsRequired() |
|
||||
.HasMaxLength(256) |
|
||||
.HasColumnType("character varying(256)") |
|
||||
.HasComment("角色名称"); |
|
||||
|
|
||||
b.Property<string>("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<string>("Id") |
|
||||
.HasColumnType("text") |
|
||||
.HasComment("用户ID,主键"); |
|
||||
|
|
||||
b.Property<int>("AccessFailedCount") |
|
||||
.HasColumnType("integer") |
|
||||
.HasComment("登录失败次数"); |
|
||||
|
|
||||
b.Property<string>("ConcurrencyStamp") |
|
||||
.IsConcurrencyToken() |
|
||||
.HasColumnType("text") |
|
||||
.HasComment("并发控制戳"); |
|
||||
|
|
||||
b.Property<string>("Email") |
|
||||
.IsRequired() |
|
||||
.HasMaxLength(256) |
|
||||
.HasColumnType("character varying(256)") |
|
||||
.HasComment("电子邮箱"); |
|
||||
|
|
||||
b.Property<bool>("EmailConfirmed") |
|
||||
.HasColumnType("boolean") |
|
||||
.HasComment("邮箱是否已验证"); |
|
||||
|
|
||||
b.Property<bool>("LockoutEnabled") |
|
||||
.HasColumnType("boolean") |
|
||||
.HasComment("是否启用账户锁定"); |
|
||||
|
|
||||
b.Property<DateTimeOffset?>("LockoutEnd") |
|
||||
.HasColumnType("timestamp with time zone") |
|
||||
.HasComment("账户锁定结束时间"); |
|
||||
|
|
||||
b.Property<string>("NormalizedEmail") |
|
||||
.HasMaxLength(256) |
|
||||
.HasColumnType("character varying(256)") |
|
||||
.HasComment("标准化电子邮箱(大写)"); |
|
||||
|
|
||||
b.Property<string>("NormalizedUserName") |
|
||||
.HasMaxLength(256) |
|
||||
.HasColumnType("character varying(256)") |
|
||||
.HasComment("标准化用户名(大写)"); |
|
||||
|
|
||||
b.Property<string>("PasswordHash") |
|
||||
.HasColumnType("text") |
|
||||
.HasComment("密码哈希值"); |
|
||||
|
|
||||
b.Property<string>("PhoneNumber") |
|
||||
.IsRequired() |
|
||||
.HasColumnType("text") |
|
||||
.HasComment("电话号码"); |
|
||||
|
|
||||
b.Property<bool>("PhoneNumberConfirmed") |
|
||||
.HasColumnType("boolean") |
|
||||
.HasComment("电话号码是否已验证"); |
|
||||
|
|
||||
b.Property<string>("SecurityStamp") |
|
||||
.HasColumnType("text") |
|
||||
.HasComment("安全戳,用于并发控制"); |
|
||||
|
|
||||
b.Property<bool>("TwoFactorEnabled") |
|
||||
.HasColumnType("boolean") |
|
||||
.HasComment("是否启用双因素认证"); |
|
||||
|
|
||||
b.Property<string>("UserName") |
|
||||
.IsRequired() |
|
||||
.HasMaxLength(256) |
|
||||
.HasColumnType("character varying(256)") |
|
||||
.HasComment("用户名"); |
|
||||
|
|
||||
b.HasKey("Id"); |
|
||||
|
|
||||
b.HasIndex("Email") |
|
||||
.IsUnique() |
|
||||
.HasDatabaseName("IX_Users_Email"); |
|
||||
|
|
||||
b.HasIndex("NormalizedEmail") |
|
||||
.HasDatabaseName("EmailIndex"); |
|
||||
|
|
||||
b.HasIndex("NormalizedUserName") |
|
||||
.IsUnique() |
|
||||
.HasDatabaseName("UserNameIndex"); |
|
||||
|
|
||||
b.HasIndex("PhoneNumber") |
|
||||
.IsUnique() |
|
||||
.HasDatabaseName("IX_Users_PhoneNumber"); |
|
||||
|
|
||||
b.HasIndex("UserName") |
|
||||
.IsUnique() |
|
||||
.HasDatabaseName("IX_Users_UserName"); |
|
||||
|
|
||||
b.ToTable("Users", null, t => |
|
||||
{ |
|
||||
t.HasComment("用户表"); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
||||
modelBuilder.Entity("CellularManagement.Domain.Entities.UserRole", b => |
|
||||
{ |
|
||||
b.Property<string>("UserId") |
|
||||
.HasColumnType("text"); |
|
||||
|
|
||||
b.Property<string>("RoleId") |
|
||||
.HasColumnType("text"); |
|
||||
|
|
||||
b.HasKey("UserId", "RoleId"); |
|
||||
|
|
||||
b.HasIndex("RoleId"); |
|
||||
|
|
||||
b.ToTable("UserRoles", null, t => |
|
||||
{ |
|
||||
t.HasComment("用户角色关系表"); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
||||
modelBuilder.Entity("CellularManagement.Domain.Entities.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"); |
|
||||
}); |
|
||||
#pragma warning restore 612, 618
|
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,30 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace CellularManagement.Infrastructure.Migrations |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
public partial class AddRoleDescription : Migration |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.AddColumn<string>( |
|
||||
name: "Description", |
|
||||
table: "Roles", |
|
||||
type: "character varying(500)", |
|
||||
maxLength: 500, |
|
||||
nullable: true, |
|
||||
comment: "角色描述"); |
|
||||
} |
|
||||
|
|
||||
/// <inheritdoc />
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.DropColumn( |
|
||||
name: "Description", |
|
||||
table: "Roles"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
Loading…
Reference in new issue