Files
WMSlite/WmsLite.Api/Database/migrations/0013_OrderNoCounter.cs
T
zhougfandCursor fa1b286463 Add WmsLite monorepo with JWT auth, tenant context, and project READMEs.
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>
2026-05-24 14:17:47 +08:00

37 lines
1.2 KiB
C#

using FluentMigrator;
namespace WmsLite.Api.Database.Migrations;
[Migration(13, "Order number counter table")]
public class OrderNoCounter0013 : Migration
{
public override void Up()
{
if (!Schema.Table("order_no_counter").Exists())
{
Create.Table("order_no_counter")
.WithColumn("id").AsInt64().PrimaryKey().NotNullable()
.WithColumn("tenant_id").AsString(64).NotNullable()
.WithColumn("owner_code").AsString(64).NotNullable()
.WithColumn("prefix").AsString(16).NotNullable()
.WithColumn("date_yyyymmdd").AsString(8).NotNullable()
.WithColumn("last_seq").AsInt32().NotNullable().WithDefaultValue(0)
.WithColumn("create_time").AsDateTime().Nullable()
.WithColumn("update_time").AsDateTime().Nullable();
}
Execute.Sql("""
CREATE UNIQUE INDEX IF NOT EXISTS uq_order_no_counter_scope
ON order_no_counter (tenant_id, owner_code, prefix, date_yyyymmdd);
""");
}
public override void Down()
{
if (Schema.Table("order_no_counter").Exists())
{
Delete.Table("order_no_counter");
}
}
}