//
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
{
///
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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("datetime2");
b.Property("CreatedByIp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property("ExpiresAt")
.HasColumnType("datetime2");
b.Property("ReplacedByToken")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property("RevokedAt")
.HasColumnType("datetime2");
b.Property("RevokedByIp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property("Token")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CreatedAt")
.HasColumnType("datetime2");
b.Property("Email")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property("LastLoginAt")
.HasColumnType("datetime2");
b.Property("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property("PasswordHash")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property("Status")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property("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
}
}
}