Implement API security baseline (sys_user, JWT, audit fields, transactions, unique constraints) and Web real login with 401 handling. Document setup and development workflows in root, WmsLite.Api, and WmsLite.Web README files. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using FluentMigrator;
|
|
|
|
namespace WmsLite.Api.Database.Migrations;
|
|
|
|
/// <summary>
|
|
/// 修复曾用 SqlSugar CodeFirst 加列但现有行为 NULL 的库(NOT NULL 约束失败)。
|
|
/// </summary>
|
|
[Migration(6, "Backfill order line received_qty / line_status nulls")]
|
|
public class BackfillOrderLineQtyAndStatus0006 : Migration
|
|
{
|
|
private static readonly string[] Tables = { "inbound_order_line", "outbound_order_line", "stocktake_order_line" };
|
|
|
|
public override void Up()
|
|
{
|
|
foreach (var table in Tables)
|
|
{
|
|
if (!Schema.Table(table).Exists())
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (Schema.Table(table).Column("received_qty").Exists())
|
|
{
|
|
Execute.Sql($"UPDATE {table} SET received_qty = 0 WHERE received_qty IS NULL;");
|
|
Execute.Sql($"ALTER TABLE {table} ALTER COLUMN received_qty SET DEFAULT 0;");
|
|
Execute.Sql($"ALTER TABLE {table} ALTER COLUMN received_qty SET NOT NULL;");
|
|
}
|
|
|
|
if (Schema.Table(table).Column("line_status").Exists())
|
|
{
|
|
Execute.Sql($"UPDATE {table} SET line_status = 1 WHERE line_status IS NULL;");
|
|
Execute.Sql($"ALTER TABLE {table} ALTER COLUMN line_status SET DEFAULT 1;");
|
|
Execute.Sql($"ALTER TABLE {table} ALTER COLUMN line_status SET NOT NULL;");
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void Down()
|
|
{
|
|
}
|
|
}
|