feat: record who created join codes and who added each node [CI]

This commit is contained in:
justme committed 2026-10-07 22:12:15 +08:00
1 parent 6385c1b9a3
commit 359313a57b
19 files changed
+95 -37

No files matched your search

@@ -5,7 +5,7 @@ namespace MoShiro.Backend.Storage.Sqlite;
/// <summary>表结构。版本记录在 <c>PRAGMA user_version</c>;以后的迁移是按版本号追加的内置 SQL。</summary>
internal static class Schema
{
public const int CurrentVersion = 12;
public const int CurrentVersion = 13;
public static void Migrate(SqliteConnection connection)
{
@@ -183,6 +183,17 @@ internal static class Schema
connection.Exec("PRAGMA user_version = 12");
transaction.Commit();
}
if (version < 13)
{
// 归属:加入码是谁创建的,节点是用哪个加入码(也就是谁)加进来的;审计日志
using SqliteTransaction transaction = connection.BeginTransaction();
connection.Exec("ALTER TABLE join_tokens ADD COLUMN created_by TEXT");
connection.Exec("ALTER TABLE agents ADD COLUMN added_by TEXT");
connection.Exec("ALTER TABLE probes ADD COLUMN added_by TEXT");
connection.Exec("PRAGMA user_version = 13");
transaction.Commit();
}
}
/// <summary>