mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-14 07:50:05 +00:00
chore(preflight): annotate small _async_migrations schema ops
The pr-preflight async-migration gate flags any new ALTER TABLE / CREATE TABLE in a migration-shaped file without an explicit annotation. Two sites are legitimately safe-at-scale but lacked the annotation: - cmd/ingestor/async_migration_progress.go ADD COLUMN on the bookkeeping table _async_migrations (single-digit rows; ADD COLUMN is O(rows)). - cmd/server/async_migrations_test.go CREATE TABLE on a fresh in-memory test DB (test setup, not a real schema migration). Annotation-only — no behavior change. Both call sites already had runtime safeguards (duplicate-column tolerance, test isolation). cross-stack: justified — annotations only; no functional change. PR #1735 already declares the frontend+backend coupling.
This commit is contained in:
@@ -44,6 +44,7 @@ func ensureAsyncMigrationProgressColumns(db *sql.DB) error {
|
||||
{"last_update_at", "TEXT"},
|
||||
}
|
||||
for _, c := range cols {
|
||||
// PREFLIGHT: async=true reason="_async_migrations is the migration bookkeeping table itself — bounded to one row per known migration name (single-digit rows in practice, never grows with data). ALTER TABLE ADD COLUMN on this table is O(rows) and completes in microseconds even on prod-size DBs."
|
||||
_, err := db.Exec(fmt.Sprintf(
|
||||
`ALTER TABLE _async_migrations ADD COLUMN %s %s`, c.name, c.typ))
|
||||
if err != nil && !isDuplicateColumnErr(err) {
|
||||
|
||||
@@ -18,6 +18,7 @@ func openAsyncTestDB(t *testing.T) *sql.DB {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { db.Close() })
|
||||
// PREFLIGHT: async=true reason="test fixture CREATE TABLE on a fresh in-memory SQLite DB — not a real schema migration; runs in test setup only."
|
||||
_, err = db.Exec(`
|
||||
CREATE TABLE _async_migrations (
|
||||
name TEXT PRIMARY KEY,
|
||||
|
||||
Reference in New Issue
Block a user