feat(db): V11 migration drops dead knowledge_edges + compressed_memories tables

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.
This commit is contained in:
Sam Valladares 2026-04-19 16:44:41 -05:00
parent 6c24a0ca69
commit 822a7c835b

View file

@ -54,6 +54,11 @@ pub const MIGRATIONS: &[Migration] = &[
description: "v2.0.5 Intentional Amnesia: active forgetting — top-down suppression (Anderson 2025 + Davis Rac1)", description: "v2.0.5 Intentional Amnesia: active forgetting — top-down suppression (Anderson 2025 + Davis Rac1)",
up: MIGRATION_V10_UP, 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 /// 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'); 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 /// Get current schema version from database
pub fn get_current_version(conn: &rusqlite::Connection) -> rusqlite::Result<u32> { pub fn get_current_version(conn: &rusqlite::Connection) -> rusqlite::Result<u32> {
conn.query_row( conn.query_row(