versiondb

command
v0.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Command versiondb 用「某个历史版本自己的代码」建出一个该版本的数据库文件。

为什么不能只靠 testdata/upstream_schema.sql:那份快照只是 master 当前这一代结构。 更老的版本(v0.1.0 的 models 表还有 io_log、还没有 configs 表)建出来的库完全 是另一种形态,只有让那个版本自己的 models.Init 跑一遍才拿得到真实结构——手写 DDL 永远只能证明「按我以为的旧结构能升级」。

用法(CI 里由 .github/workflows/db-compat.yml 对每个历史版本各跑一次):

go run ./tools/versiondb -ref v0.5.0 -out /tmp/v0.5.0.db

做法:git archive 导出该 ref 的源码 → 塞一个探针包进去 → 让**那个模块自己** 编译并运行探针(探针只调用它的 models.Init)→ 留下建好的库文件。 探针不用当前代码,因此不会把新结构混进旧库。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL