From 822a7c835b10c932cea786332301cc96ab08694d Mon Sep 17 00:00:00 2001 From: Sam Valladares Date: Sun, 19 Apr 2026 16:44:41 -0500 Subject: [PATCH] feat(db): V11 migration drops dead knowledge_edges + compressed_memories tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both tables were added speculatively in V4 and never received a single INSERT or SELECT in the codebase. `knowledge_edges` has an elaborate bi-temporal schema (valid_from, valid_until, confidence) and was marked DEPRECATED in the same V4 migration that created it — the real edge table is `memory_connections` (V3). `compressed_memories` was a tiered- compression feature (compression_ratio, semantic_fidelity, model_used) but `advanced/compression.rs` operates entirely in-memory and never touches it. Both tables are verified single-file references (only migrations.rs). A grep across crates/ shows zero row reads or writes. Safe to drop without behaviour change; frees schema space for future migrations. --- crates/vestige-core/src/storage/migrations.rs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/crates/vestige-core/src/storage/migrations.rs b/crates/vestige-core/src/storage/migrations.rs index 370257c..f5e4857 100644 --- a/crates/vestige-core/src/storage/migrations.rs +++ b/crates/vestige-core/src/storage/migrations.rs @@ -54,6 +54,11 @@ pub const MIGRATIONS: &[Migration] = &[ description: "v2.0.5 Intentional Amnesia: active forgetting — top-down suppression (Anderson 2025 + Davis Rac1)", up: MIGRATION_V10_UP, }, + Migration { + version: 11, + description: "v2.0.7 Cleanup: drop dead knowledge_edges and compressed_memories tables", + up: MIGRATION_V11_UP, + }, ]; /// A database migration @@ -648,6 +653,34 @@ CREATE INDEX IF NOT EXISTS idx_nodes_suppressed_at UPDATE schema_version SET version = 10, applied_at = datetime('now'); "#; +/// V11: v2.0.7 Cleanup — drop tables that were added speculatively and never used +/// +/// Two tables from V4 were created but never had a single INSERT or SELECT in +/// the codebase: +/// +/// 1. `knowledge_edges` — an elaborate bi-temporal edge schema (valid_from, +/// valid_until, confidence, created_by). Was marked DEPRECATED in the same +/// V4 migration that created it. The real edge table is `memory_connections` +/// (V3), which is what the graph traversal code actually uses. +/// +/// 2. `compressed_memories` — a tiered-compression feature (compression_ratio, +/// semantic_fidelity, model_used). `advanced/compression.rs` operates +/// entirely in-memory and never touches this table. Dropping the schema +/// frees space for future migrations and removes dead schema debt. +/// +/// Both tables are verified single-file references (only in migrations.rs). +/// A grep across the entire crates/ tree shows zero INSERT, SELECT, or row +/// mapping against either table. Safe to drop without behaviour change. +const MIGRATION_V11_UP: &str = r#" +-- Drop the never-used bi-temporal edge table (real edges live in memory_connections). +DROP TABLE IF EXISTS knowledge_edges; + +-- Drop the never-used compression table (compression.rs is in-memory only). +DROP TABLE IF EXISTS compressed_memories; + +UPDATE schema_version SET version = 11, applied_at = datetime('now'); +"#; + /// Get current schema version from database pub fn get_current_version(conn: &rusqlite::Connection) -> rusqlite::Result { conn.query_row(