- 将迁移文件按数据库类型分目录存放 (Migrations/SQLite, MySQL, PostgreSQL, SqlServer) - 新增各数据库提供程序的 DesignTimeDbContextFactory,支持 --provider 参数切换 - 新增 ProviderAppDataContexts,定义各数据库对应的 AppDataContext 子类 - DatabaseExtensions 增加 AddProviderAppDataContext 方法,按配置自动注册对应 DbContext - 修正 MySQL 提供程序调用方式 (UseMySql -> UseMySQL) - UserEntity 模型增加新字段 - 更新 add-migration.ps1
180 lines
6.6 KiB
C#
180 lines
6.6 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using Avalonia_EFCore.Database;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace Avalonia_EFCore.Migrations.SQLite
|
|
{
|
|
[DbContext(typeof(SqliteAppDataContext))]
|
|
[Migration("20260520083230_AutoMigration_20260520163216")]
|
|
partial class AutoMigration_20260520163216
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder.HasAnnotation("ProductVersion", "10.0.7");
|
|
|
|
modelBuilder.Entity("Avalonia_EFCore.Models.ApiRefreshTokenEntity", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER")
|
|
.HasColumnName("id");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("created-at");
|
|
|
|
b.Property<string>("Device")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("device");
|
|
|
|
b.Property<DateTime>("ExpiresAt")
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("expires-at");
|
|
|
|
b.Property<string>("IpAddress")
|
|
.HasMaxLength(64)
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("ip-address");
|
|
|
|
b.Property<string>("ReplacedByTokenHash")
|
|
.HasMaxLength(128)
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("replaced-by-token-hash");
|
|
|
|
b.Property<DateTime?>("RevokedAt")
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("revoked-at");
|
|
|
|
b.Property<string>("TokenHash")
|
|
.IsRequired()
|
|
.HasMaxLength(128)
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("token-hash");
|
|
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("INTEGER")
|
|
.HasColumnName("user-id");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk-api-refresh-token");
|
|
|
|
b.HasIndex("TokenHash")
|
|
.IsUnique()
|
|
.HasDatabaseName("idx-api-refresh-token-hash");
|
|
|
|
b.HasIndex("UserId")
|
|
.HasDatabaseName("idx-api-refresh-token-user-id");
|
|
|
|
b.ToTable("api-refresh-token", t =>
|
|
{
|
|
t.HasComment("API refresh token");
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("Avalonia_EFCore.Models.UserEntity", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER")
|
|
.HasColumnName("id")
|
|
.HasComment("用户主键");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("created-at")
|
|
.HasComment("创建时间");
|
|
|
|
b.Property<string>("Email")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("email")
|
|
.HasComment("用户邮箱");
|
|
|
|
b.Property<string>("Name")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("name")
|
|
.HasComment("用户名称");
|
|
|
|
b.Property<string>("PasswordHash")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("password-hash")
|
|
.HasComment("密码哈希值");
|
|
|
|
b.Property<string>("PhoneNumber")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("phone-number")
|
|
.HasComment("电话号码");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("updated-at")
|
|
.HasComment("更新时间");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk-user");
|
|
|
|
b.ToTable("user", t =>
|
|
{
|
|
t.HasComment("用户实体,演示数据库 CRUD 操作");
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("Avalonia_EFCore.Models.WeatherForecastEntity", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER")
|
|
.HasColumnName("id")
|
|
.HasComment("天气预报主键");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("created-at")
|
|
.HasComment("创建时间");
|
|
|
|
b.Property<DateOnly>("Date")
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("date")
|
|
.HasComment("预报日期");
|
|
|
|
b.Property<string>("Summary")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("summary")
|
|
.HasComment("天气摘要");
|
|
|
|
b.Property<int>("TemperatureC")
|
|
.HasColumnType("INTEGER")
|
|
.HasColumnName("temperature-c")
|
|
.HasComment("摄氏温度");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("TEXT")
|
|
.HasColumnName("updated-at")
|
|
.HasComment("更新时间");
|
|
|
|
b.HasKey("Id")
|
|
.HasName("pk-weather-forecast");
|
|
|
|
b.ToTable("weather-forecast", t =>
|
|
{
|
|
t.HasComment("天气预报数据实体");
|
|
});
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|