145 lines
5.0 KiB
C#
145 lines
5.0 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using LingAdmin.IdentityService.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace LingAdmin.IdentityService.Migrations
|
|
{
|
|
[DbContext(typeof(IdentityDbContext))]
|
|
[Migration("20260203081844_InitialCreate")]
|
|
partial class InitialCreate
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "9.0.0")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
|
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("LingAdmin.Shared.Models.RefreshToken", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("CreatedByIp")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<DateTime>("ExpiresAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("ReplacedByToken")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<DateTime?>("RevokedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("RevokedByIp")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<string>("Token")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Token")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("UserId");
|
|
|
|
b.ToTable("RefreshTokens");
|
|
});
|
|
|
|
modelBuilder.Entity("LingAdmin.Shared.Models.User", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("Email")
|
|
.IsRequired()
|
|
.HasMaxLength(255)
|
|
.HasColumnType("nvarchar(255)");
|
|
|
|
b.Property<DateTime?>("LastLoginAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("PasswordHash")
|
|
.IsRequired()
|
|
.HasMaxLength(255)
|
|
.HasColumnType("nvarchar(255)");
|
|
|
|
b.Property<string>("Status")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<DateTime?>("UpdatedAt")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Email")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Users");
|
|
|
|
b.HasData(
|
|
new
|
|
{
|
|
Id = 1,
|
|
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
|
Email = "admin@lingadmin.com",
|
|
Name = "System Admin",
|
|
PasswordHash = "$2a$11$K7VJyGqVhWD0VvHK8YxGOOQkJvYQJLHN7O0zLPqL4gFx5lK3qR8sC",
|
|
Status = "Active"
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("LingAdmin.Shared.Models.RefreshToken", b =>
|
|
{
|
|
b.HasOne("LingAdmin.Shared.Models.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("User");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|