Repository navigation
v2.7.0
This release needs Go 1.27.1 and a migrate run, and the code generator now writes Vue 3 pages. Read the section below before upgrading.
⚠️ Before you upgrade
1. Build with Go 1.27.1 or later. Under Go 1.26.5, govulncheck reports 7 standard-library vulnerabilities reachable from this code; under 1.27.1 it reports none. go-admin-core v2.10.0 and later declare go 1.27.1. #948
2. Run migrate. Six migrations are new, 1786700005000 to 1786700010000, among them the application registry, the job scheduler's lease row and the generator's column layout fields. Until they are applied, the new /api/v1/ready answers 503 and names the database that is behind. On PostgreSQL, v2.6.0 stopped at 1786700003000, after which logins failed with unable to encode 0 into binary format for timestamptz; that migration is fixed here, so run migrate again. #921 #922
3. The code generator writes files only in dev and demo mode. Its three writing endpoints were open to any logged-in account. With application.mode set to test or prod, or not set, they are no longer registered. Generated pages are now Vue 3 and need go-admin-ui v3.3.0 or later. #917 #943 #951
- 🔒 Security
- 🔒 Any logged-in user could change another user's profile, role included, through
PUT /api/v1/sys-user. #896 - 🔒 Data permission failed open three ways: a database error let the request through unscoped, an unrecognised
data_scopemeant all data, and department id 0 matched every department. An unrecognised scope now matches nothing, and a migration sets such values, including the empty one the seed gaveadmin, to1(all data). #897 #904 - 🔒 Demo mode let the code generator's writing endpoints through, because they are GET requests. #913
- 🔒 Any logged-in user could change another user's profile, role included, through
- Deployment and shutdown
- ✨
SIGTERMruns the graceful shutdown. OnlySIGINTdid, sodocker stop, Kubernetes and systemd ended the process mid-request. #903 - ✨
/api/v1/readyreports whether the database, cache and schema are usable, and fails from the moment shutdown starts.extend.shutdown.drainkeeps serving for a set time before the listener closes./healthis unchanged. #908 #912 #921 - ✨ Several instances can share one database: a lease in
sys_job_leaselets one of them run the scheduled jobs. Before, every instance ran every job, and each start cleared the others' job entries. #947 - 🐛 The job scheduler started for the first tenant database only and was never stopped on exit, and a failed port bind still reported the server as started. With several tenant databases, the other tenants' enabled jobs now run. #906
- 🐛 The queue carrying the login log, operation log and API sync is drained on exit and on a configuration reload instead of dropped. #918 #909
- 🐛
migrateexits non-zero when it fails, including when the database is unreachable. It used to print the error and exit 0. #926 - 🐛 Stopping a job that timed out reported success. #924 @jackwalkerlabs
- 👌 The Docker image no longer installs gcc and g++, 273MB of its 381MB. #925
- ✨
- Installable applications
- ✨
migrate install <code>andmigrate uninstall <code>install and remove an application compiled into the binary, recorded insys_app.migrate status,--dry-runand--appshow and limit what runs, per application. #891 #923 #926 #931 #934 - ✨
example/app-orderis a reference application that depends only on go-admin-core, anddocs/contract.mdstates what an application can rely on.common/models,common/dtoandcommon/actionsare now aliases of core's contract packages; existing code compiles unchanged. #898 #899 #900 #901 #902
- ✨
- Code generator
- ✨ Generates Vue 3 and TypeScript pages built on
PageContainer,ProTable,useTableanduseForm, with language packs, column widths and default values. #943 - ✨ Any single-column primary key, int or string, generates a working backend and page. A table without exactly one key column is refused. #950 #951
- 🐛 A generated
Updatethat did not find its row inserted a new one. Services generated by earlier versions keep thatUpdate: regenerate them, or apply the change in #950 by hand. #950 - 🐛 Saving a table's configuration or generating code reported success when part of it failed, and a path it could not write ended the server process. #952 #953
- 🐛
created_atandupdated_atcan be listed and queried from the config page, and a table with nothing to enter gets no empty form. #954 - 🐛 Importing tables failed with go-admin-ui v3.2.0. #936
- ✨ Generates Vue 3 and TypeScript pages built on
- Other fixes
- 🐛 On PostgreSQL, operation log rows whose result held multi-byte characters were silently dropped. #944 @amiaogo
- 🐛
config/pg.sqlcalibrated sequences no column uses forsys_configandsys_job, leaving their real ones unset. #945 @amiaogo - 🐛 The password hook hashed an already-hashed password again when a user row was saved with it. It now leaves a hash alone. #889
- 🐛
SysApi.Updateignored data permission. #889 - 🐛 The
Cache-Controlheader carried a strayvaluetoken. #938 - 👌 A request body is copied only when the operation log stores it, and at most 32KB of it. A 1MB upload used to allocate 4.3MB. #889
- 🔧 go-admin-core v2.3.0 → v2.11.0. #894 #909 #949 #953
- ✅ CI runs the tests with the race detector against MySQL, PostgreSQL, SQL Server and Redis, and fails on unformatted code. #888 #922 #927 #942 #939 #937 #946 #907 #905 @Tuoxie423
- 📝 Documentation fixes. #887 #893 #910 #916 #930 #941 @Tuoxie423
本次发布需要 Go 1.27.1 并执行一次 migrate,代码生成器改为生成 Vue 3 页面。升级前请先读下面这一节。
⚠️ 升级前
1. 用 Go 1.27.1 或更高版本编译。 在 Go 1.26.5 下,govulncheck 报告本代码会触及 7 个标准库漏洞;在 1.27.1 下为 0。go-admin-core v2.10.0 起声明 go 1.27.1。#948
2. 执行 migrate。 新增 6 个迁移(1786700005000 至 1786700010000),包括应用注册表、定时任务的租约行、代码生成器的列布局字段。迁移完成前,新增的 /api/v1/ready 返回 503,并指出是哪个库落后了。PostgreSQL 上,v2.6.0 会卡在 1786700003000,之后登录报 unable to encode 0 into binary format for timestamptz;本版修好了这个迁移,请再执行一次 migrate。#921 #922
3. 代码生成器只在 dev 和 demo 模式下写文件。 它的三个写接口此前任何已登录账号都能调用。application.mode 为 test、prod 或未设置时,这三个接口不再注册。生成的页面改为 Vue 3,需要 go-admin-ui v3.3.0 或更高版本。#917 #943 #951
- 🔒 安全
- 部署与关闭
- ✨
SIGTERM会执行优雅关闭。此前只处理SIGINT,所以docker stop、Kubernetes 和 systemd 会在请求处理途中直接结束进程。#903 - ✨
/api/v1/ready报告数据库、缓存和表结构是否可用,并从开始关闭的那一刻起返回失败。extend.shutdown.drain可以在关闭监听前继续服务一段设定的时间。/health不变。#908 #912 #921 - ✨ 多个实例可以共用一个库:
sys_job_lease里的租约让其中一个实例执行定时任务。此前每个实例都执行全部任务,而且每次启动都会清掉其他实例的任务记录。#947 - 🐛 定时任务调度器只为第一个租户库启动,退出时也从未被停止;端口绑定失败时仍报告服务已启动。配置了多个租户库时,其他租户里启用的任务现在会开始运行。#906
- 🐛 承载登录日志、操作日志和 API 同步的队列,在退出和配置热重载时会先排空,不再丢弃。#918 #909
- 🐛
migrate失败时以非零码退出,包括数据库连不上的情况。此前只打印错误、以 0 退出。#926 - 🐛 停止任务超时时报告成功。#924 @jackwalkerlabs
- 👌 Docker 镜像不再安装 gcc 和 g++,它们占 381MB 中的 273MB。#925
- ✨
- 可安装应用
- ✨
migrate install <code>和migrate uninstall <code>安装、卸载编译进二进制的应用,并记录在sys_app。migrate status、--dry-run和--app按应用显示和限定要执行的内容。#891 #923 #926 #931 #934 - ✨
example/app-order是只依赖 go-admin-core 的参照应用,docs/contract.md说明应用可以依赖什么。common/models、common/dto和common/actions改为 core 契约包的别名,现有代码无需修改即可编译。#898 #899 #900 #901 #902
- ✨
- 代码生成器
- ✨ 生成 Vue 3 + TypeScript 页面,基于
PageContainer、ProTable、useTable和useForm,带语言包、列宽和默认值。#943 - ✨ 任意单列主键(int 或 string)都能生成可用的后端和页面。主键不是恰好一列的表会被拒绝。#950 #951
- 🐛 生成的
Update找不到记录时会插入一条新记录。旧版本生成的 service 仍是原来的Update:请重新生成,或按 #950 手工修改。#950 - 🐛 保存表配置或生成代码时部分失败仍报告成功;写不了的路径会让服务进程退出。#952 #953
- 🐛 配置页可以把
created_at和updated_at设为列表列和查询条件;没有可填写字段的表不再生成空表单。#954 - 🐛 配合 go-admin-ui v3.2.0 导入表时失败。#936
- ✨ 生成 Vue 3 + TypeScript 页面,基于
- 其他修复
- 🐛 PostgreSQL 上,返回值含多字节字符的操作日志会被静默丢弃。#944 @amiaogo
- 🐛
config/pg.sql为sys_config和sys_job校准的是没有任何列使用的序列,真正的序列没有被设置。#945 @amiaogo - 🐛 保存用户时若带上了密码字段,密码钩子会把已经是哈希的密码再哈希一次。现在遇到哈希值会原样保留。#889
- 🐛
SysApi.Update没有应用数据权限。#889 - 🐛
Cache-Control响应头里多了一个value。#938 - 👌 请求体只在操作日志需要存储时才复制,且最多 32KB。此前上传 1MB 会分配 4.3MB 内存。#889
- 🔧 go-admin-core v2.3.0 → v2.11.0。#894 #909 #949 #953
- ✅ CI 带竞态检测运行测试,覆盖 MySQL、PostgreSQL、SQL Server 和 Redis,代码未格式化时失败。#888 #922 #927 #942 #939 #937 #946 #907 #905 @Tuoxie423
- 📝 文档修正。#887 #893 #910 #916 #930 #941 @Tuoxie423