Skip to content

v2.4.0

Choose a tag to compare

@wenjianzhang wenjianzhang released this 16 Aug 03:13
· 359 commits to master since this release
5864058

🚨 已知问题:MySQL 上迁移无法执行完成 / Known issue: migrations cannot complete on MySQL

本版本在 MySQL 上执行 migrate 会中断,报 Error 1264 (22003): Out of range value for column 'sort'。
种子菜单的 sort 值超出 MySQL 的 tinyint 范围,而迁移框架不是事务性的,运行到此为止。

后果是下面这段清理迁移从未执行 —— 它排在出错的那条之后,所以本页要求的
「清理库中的残留权限数据」在 MySQL 上并没有生效。sqlite 忽略列宽,不受影响。

已在 v2.5.0 修复,建议直接升级;
v2.5.0 同时修复了另外十余个问题,其中包含一个会把数据库密码写进日志的缺陷。


Running migrate on MySQL stops partway with Error 1264 (22003): Out of range value for column 'sort'.
A seeded menu's sort exceeds MySQL's tinyint, and the migration framework is not transactional, so the run ends there.

The cleanup migration below therefore never ran — it is ordered after the one that fails, so the
"清理库中的残留权限数据" this page asks for did not take effect on MySQL. sqlite ignores the declared width and is unaffected.

Fixed in v2.5.0, which is the recommended upgrade.

⚠️ 破坏性变更

移除 GET /api/v1/refresh_token

该接口用业务 token 即可换取新 token,而续期上限 MaxRefresh 依据的 orig_iat
在每次续期时被一并重置 —— 上限永远无法到达。token 一旦泄露即等同于永久访问权,
且框架没有任何吊销手段。它此前还位于 CasbinExclude 中,不受权限约束,任何角色
的已登录用户都能调用。

官方前端从未使用该接口,正常升级不受影响。

若你自行调用该端点实现续期,需改为重新登录。正确的无感续期应在
go-admin-core 中区分 access token 与 refresh token 后重新实现。

升级后请执行迁移,清理库中的残留权限数据:

./go-admin migrate -c config/settings.yml

🔒 安全

✨ 新功能

  • 新增 app/demo 标准 CRUD 参照模块 —— 一个完整的单表 CRUD 只需 model +
    dto + router 三个文件。它使用 common/actions 的五个通用 Action,无需手写
    Handler 与 Service。可编译、有测试、CI 会跑,替代此前只能靠模板传递的写法
  • 新增 AGENTS.md —— 给 AI 编码工具与新贡献者的约定,只写"不遵守就会出错"
    的规则
  • 新增 docs/architecture.md —— 数据权限五级模型、JobExec 接口、多数据源、
    迁移目录划分

🐛 修复

  • 修正 GeneralDelDto.GetIds 重复追加 Id
  • 修正欢迎页 iframe 高度塌陷
  • 限制部署步骤仅在 master 收到 push 时执行 —— 此前 PR 可触发生产部署

🔧 其他

  • 补充 sqlite3 构建标签说明:driver: sqlite3 时必须 go run -tags sqlite3 .,
    否则启动即 panic 且报错不提及构建标签
  • 修正 .DS_Store 忽略规则(原模式匹配不到仓库根目录)
  • 修正文件名拼写 int_router.go → init_router.go
  • 更新在线体验地址

配套前端版本:go-admin-ui v3.1.0