- 将迁移文件按数据库类型分目录存放 (Migrations/SQLite, MySQL, PostgreSQL, SqlServer) - 新增各数据库提供程序的 DesignTimeDbContextFactory,支持 --provider 参数切换 - 新增 ProviderAppDataContexts,定义各数据库对应的 AppDataContext 子类 - DatabaseExtensions 增加 AddProviderAppDataContext 方法,按配置自动注册对应 DbContext - 修正 MySQL 提供程序调用方式 (UseMySql -> UseMySQL) - UserEntity 模型增加新字段 - 更新 add-migration.ps1
31 lines
833 B
C#
31 lines
833 B
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Avalonia_EFCore.Migrations.MySQL
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AutoMigration_20260520163216 : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "password-hash",
|
|
table: "user",
|
|
type: "varchar(200)",
|
|
maxLength: 200,
|
|
nullable: true,
|
|
comment: "密码哈希值");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "password-hash",
|
|
table: "user");
|
|
}
|
|
}
|
|
}
|