跳转到内容

VFS PRAGMA

SQLite 扩展属于数据面。生产环境中的 PRAGMA 只负责控制或检查当前 vfs=graft 数据库背后的 Graft Volume。

repository 操作不再通过 SQLite 暴露。status、stage、commit、branch、merge、 remote 和 JSON 输出都使用 CLI:

Terminal window
graft status --json
graft add data.sqlite
graft commit -m "save checkpoint"
graft diff --json --rows HEAD~1 HEAD data.sqlite

调用已经移除的 repository PRAGMA,例如 PRAGMA graft_status,会返回错误并提示 使用 Graft CLI。

PRAGMA graft_version;

返回 extension version;构建信息可用时也会一并返回。

下面的命令检查当前 VFS database 绑定的 Volume:

PRAGMA graft_debug_volume_info;
PRAGMA graft_debug_volume_json_info;
PRAGMA graft_debug_volume_status;
PRAGMA graft_debug_volume_list;
PRAGMA graft_debug_volume_json_list;
PRAGMA graft_debug_volume_tags;
PRAGMA graft_debug_volume_snapshot;
PRAGMA graft_debug_volume_dump_header;
PRAGMA graft_debug_log_lsn;
PRAGMA graft_debug_volume_table_log = 'users';
PRAGMA graft_debug_volume_json_table_log = 'users';

这些低层控制会创建、选择、fork 或移动当前打开的 Volume:

PRAGMA graft_debug_volume_new;
PRAGMA graft_debug_volume_switch = '<volume>[:<local-log>[:<remote-log>]]';
PRAGMA graft_debug_volume_clone = '<remote-log>';
PRAGMA graft_debug_volume_fork;
PRAGMA graft_debug_volume_checkout_lsn = '12';
PRAGMA graft_debug_volume_reset_to = '12';
PRAGMA graft_debug_volume_set_message = 'storage commit message';

它们操作 storage history,不操作 repository commit 或 branch。

PRAGMA graft_debug_volume_fetch;
PRAGMA graft_debug_volume_pull;
PRAGMA graft_debug_volume_push;
PRAGMA graft_debug_volume_audit;
PRAGMA graft_debug_volume_json_audit;
PRAGMA graft_debug_volume_hydrate;
PRAGMA graft_debug_volume_export = '/tmp/snapshot.sqlite';

graft_debug_volume_import 只保留为 deprecated error,并提示改用 SQLite VACUUM INTO;它不是受支持的 import workflow。

PRAGMA graft_debug_show_lsn = '<log-ref>';
PRAGMA graft_debug_diff_lsn = '<from-log-ref>,<to-log-ref>';
PRAGMA graft_debug_volume_dump_commit = '<log-ref>';
PRAGMA graft_debug_volume_diff = '2,4';
PRAGMA graft_debug_volume_diff = '2,4,rows';
PRAGMA graft_debug_volume_json_diff = '2,4,rows';
已移除的 SQLite 表面替代方式
PRAGMA graft_statusgraft statusgraft status --json
PRAGMA graft_addgraft add <path>graft add --all
PRAGMA graft_commitgraft commit -m <message>
PRAGMA graft_diffgraft diff,可加 --rows--json
branch、merge、conflict PRAGMAgraft branchswitchmergeconflictsresolve
remote 和 sync PRAGMAgraft remotefetchpullpush

这层分离让 SQLite 负责数据库事务,让 Graft repository service 负责版本控制操作。