refactor: 全部源文件重命名为蛇形命名(Orm.cj→orm.cj、MigrationRegistry.cj→migration_registry.cj 等 27 个),同步迁移 CLI 注册文件路径与测试,消除 G.NAM.02 警告,版本 1.3.1
This commit is contained in:
@@ -272,7 +272,7 @@ public class InitGames {
|
||||
orm-cj/
|
||||
├── cjpm.toml # 包配置(name = orm, organization = simcu)
|
||||
├── src/
|
||||
│ ├── Orm.cj # 聚合导出:import simcu::orm.* 即全部可见
|
||||
│ ├── orm.cj # 聚合导出:import simcu::orm.* 即全部可见
|
||||
│ ├── annotations/ # @Table / @Column / @Key / @AutoIncrement / @Ignore / @Required / @MaxLength / @Index / @TableIndex
|
||||
│ ├── macros/ # @DbContext 类级宏 + @Seed 数据填充宏(自动注册,无需手写注册表)
|
||||
│ ├── seeds/ # Seed 基类 + 进程级填充注册表(registerSeed / allSeeds)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
name = "orm"
|
||||
organization = "simcu"
|
||||
description = "SimApi 数据访问层 ORM:数据模型映射 + 增删改查 + 数据库迁移;多方言架构,内置 openGauss/PostgreSQL 方言"
|
||||
version = "1.3.0"
|
||||
version = "1.3.1"
|
||||
target-dir = ""
|
||||
output-type = "static"
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* - 模型:反射收集实例的 DbSet<T> 属性(getModels())
|
||||
* - 连接/驱动/方言:构造参数
|
||||
* - 迁移列表:子类 override migrations()(宏默认返回 orm-cj 全局注册表,
|
||||
* CLI 生成的 src/migrations/MigrationRegistry.cj 在模块加载时自动注册)
|
||||
* CLI 生成的 src/migrations/migration_registry.cj 在模块加载时自动注册)
|
||||
*
|
||||
* 注意:应用侧(DataContext.cj 或 main.cj)需要一行
|
||||
* import <应用包名>.migrations.*
|
||||
@@ -55,7 +55,7 @@ public class MigrationCli {
|
||||
// 注册文件与迁移文件同目录(src/migrations/,package = 应用包名.migrations)。
|
||||
// 子包默认惰性加载,顶层 let 不会执行;应用侧需一行
|
||||
// `import <应用包名>.migrations.*` 触发加载后,注册才生效。
|
||||
private var _registryPath = "src/migrations/MigrationRegistry.cj"
|
||||
private var _registryPath = "src/migrations/migration_registry.cj"
|
||||
|
||||
public init() {}
|
||||
|
||||
@@ -271,7 +271,7 @@ public class MigrationCli {
|
||||
for (f in Directory.readFrom(dir)) {
|
||||
if (f.isRegular()) {
|
||||
let name = f.name
|
||||
if (name.endsWith(".cj") && name != "MigrationRegistry.cj" && name != "_placeholder.cj") {
|
||||
if (name.endsWith(".cj") && name != "migration_registry.cj" && name != "_placeholder.cj") {
|
||||
ids.add(name[..name.size - 3])
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2025 SimcuTeam. All rights reserved.
|
||||
* 迁移落盘生成器(对齐 dotnet ef migrations add):
|
||||
* - Migration 对象 → .cj 源文件文本(迁移类 up/down 用 MigrationBuilder 声明式重建),
|
||||
* - 自动维护迁移注册文件 MigrationRegistry.cj(add 时插入新迁移实例)。
|
||||
* - 自动维护迁移注册文件 migration_registry.cj(add 时插入新迁移实例)。
|
||||
*
|
||||
* 生成文件的格式:
|
||||
* // 此文件由 simcu::orm CLI 自动生成,请勿手动编辑
|
||||
@@ -188,7 +188,7 @@ class MigrationFileGeneratorTests {
|
||||
@Expect(text.contains("public class InitialCreate <: Migration"))
|
||||
|
||||
// 注册文件:首次创建 + 追加 + 幂等
|
||||
let registryPath = "${dir}/MigrationRegistry.cj"
|
||||
let registryPath = "${dir}/migration_registry.cj"
|
||||
fg.updateRegistry("testpkg", registryPath, "InitialCreate")
|
||||
fg.updateRegistry("testpkg", registryPath, "AddAge")
|
||||
fg.updateRegistry("testpkg", registryPath, "AddAge")
|
||||
Reference in New Issue
Block a user