Files
Kayori_MedusaPluginChargeMa…/MedusaPluginChargeMachine/Migrations/20260809152017_InitialCreate.cs
T
Kayori fa610a9bc6 Add EF Core persistence for charge machine plugin
Introduce ChargeMachineDbContext (SQLite) with ArticleContent and
ChargeHistory entities, plus migrations, and wire it up via
ConfigurePluginServices/OnAppInitialize with startup migration and
article-content seeding.

- ChargeEaChargeHandler now records each charge to ChargeHistory
- GetConfigEaChargeHandler serves article config from the DB instead
  of hardcoded values, and adds multibills/readagreement fields
- GetLastLogEaChargeHandler returns real daily totals and recent
  charge items from history, keyed by session card
- Add GetRecentChargeEaChargeHandler (paginated charge history) and
  OpChPassEaChargeHandler (PIN change)
- Update handlers to the new HandleAsync/primary-constructor style,
  file-scoped namespaces
- Bump EF Core/Identity packages and Abstractions reference to
  net10.0/10.0.10
2026-08-09 17:28:14 +02:00

54 lines
1.9 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MedusaPluginChargeMachine.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ArticleContents",
columns: table => new
{
ArticleType = table.Column<string>(type: "TEXT", nullable: false),
ArticleDoc = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ArticleContents", x => x.ArticleType);
});
migrationBuilder.CreateTable(
name: "ChargeHistories",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
CardId = table.Column<string>(type: "TEXT", nullable: false),
ChargeNum = table.Column<int>(type: "INTEGER", nullable: false),
ChargeAmount = table.Column<int>(type: "INTEGER", nullable: false),
OrderDate = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChargeHistories", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ArticleContents");
migrationBuilder.DropTable(
name: "ChargeHistories");
}
}
}