From c840b1ef4c6ae5cbe973357d2053549472ae2f90 Mon Sep 17 00:00:00 2001 From: "Newhart (NHR Agent)" Date: Sun, 12 Jul 2026 06:23:28 +0000 Subject: [PATCH 1/2] fix(pgschema): protect production tables not in schema.sql from DROP Tables that exist in production memory databases (nova_memory and victoria_memory) but are not defined in schema.sql were previously unprotected. Running pgschema plan would propose DROP TABLE for all of them, risking data loss. Protected tables: - Common (both DBs): blockers, d100_roll_log, proactive_outreach, social_interactions, user_domains - nova_memory: agent_model_denylists - victoria_memory trading desk: cash_ledger, instruments, portfolios, portfolio_asset_classes, positions, strategies, strategy_notes, trades Context: victoria_memory ownership remediation (2026-07-12) identified that pgschema plan proposed dropping 11 data-bearing trading tables. Investigation revealed the issue extends to 7 tables across nova_memory as well. --- database/.pgschemaignore | 35 +++++++++++++++++++++++++++++------ memory/.pgschemaignore | 35 +++++++++++++++++++++++++++++------ 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/database/.pgschemaignore b/database/.pgschemaignore index 15adebf..5b991f1 100644 --- a/database/.pgschemaignore +++ b/database/.pgschemaignore @@ -1,9 +1,32 @@ # Objects to exclude from pgschema management # See https://www.pgschema.com/cli/ignore # -# Example: -# [tables] -# patterns = ["temp_*", "test_*"] -# -# [views] -# patterns = ["debug_*"] +# These tables exist in production memory databases but are NOT defined in +# schema.sql. They were created dynamically or as domain extensions. +# Without this ignore list, pgschema plan will propose DROP TABLE for all +# of them — destroying live data. + +[tables] +patterns = [ + # --- Common tables (nova_memory + victoria_memory, not in schema.sql) --- + "blockers", + "d100_roll_log", + "proactive_outreach", + "social_interactions", + "user_domains", + + # --- nova_memory only --- + "agent_model_denylists", + + # --- victoria_memory trading-desk domain tables --- + # Victoria's chess-themed trading pipeline book of record. + # Dropping these destroys her entire trading operation state. + "cash_ledger", + "instruments", + "portfolio_asset_classes", + "portfolios", + "positions", + "strategies", + "strategy_notes", + "trades" +] diff --git a/memory/.pgschemaignore b/memory/.pgschemaignore index 15adebf..5b991f1 100644 --- a/memory/.pgschemaignore +++ b/memory/.pgschemaignore @@ -1,9 +1,32 @@ # Objects to exclude from pgschema management # See https://www.pgschema.com/cli/ignore # -# Example: -# [tables] -# patterns = ["temp_*", "test_*"] -# -# [views] -# patterns = ["debug_*"] +# These tables exist in production memory databases but are NOT defined in +# schema.sql. They were created dynamically or as domain extensions. +# Without this ignore list, pgschema plan will propose DROP TABLE for all +# of them — destroying live data. + +[tables] +patterns = [ + # --- Common tables (nova_memory + victoria_memory, not in schema.sql) --- + "blockers", + "d100_roll_log", + "proactive_outreach", + "social_interactions", + "user_domains", + + # --- nova_memory only --- + "agent_model_denylists", + + # --- victoria_memory trading-desk domain tables --- + # Victoria's chess-themed trading pipeline book of record. + # Dropping these destroys her entire trading operation state. + "cash_ledger", + "instruments", + "portfolio_asset_classes", + "portfolios", + "positions", + "strategies", + "strategy_notes", + "trades" +] From 82765e2f422c0f806abff5187f707a0d2c0d8b30 Mon Sep 17 00:00:00 2001 From: "Newhart (NHR Agent)" Date: Fri, 17 Jul 2026 06:48:08 +0000 Subject: [PATCH 2/2] fix(pgschema): add 5 uncatalogued victoria_memory trading tables to ignore list Identified during SE run #449's Victoria deploy tonight: the pgschema plan proposed DROPping 13 out-of-schema tables on victoria_memory. PR #466's protections covered most of them, but review caught 5 trading-desk tables still missing from the ignore list: - asset_classes - open_orders - order_adjustments - portfolio_snapshots - price_cache_v2 The destructive-drop gate caught the proposed DROPs before they ran, preventing data loss. Adding these to both database/.pgschemaignore and memory/.pgschemaignore alongside the other Victoria trading-desk tables. --- database/.pgschemaignore | 5 +++++ memory/.pgschemaignore | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/database/.pgschemaignore b/database/.pgschemaignore index 5b991f1..308db45 100644 --- a/database/.pgschemaignore +++ b/database/.pgschemaignore @@ -21,11 +21,16 @@ patterns = [ # --- victoria_memory trading-desk domain tables --- # Victoria's chess-themed trading pipeline book of record. # Dropping these destroys her entire trading operation state. + "asset_classes", "cash_ledger", "instruments", + "open_orders", + "order_adjustments", "portfolio_asset_classes", + "portfolio_snapshots", "portfolios", "positions", + "price_cache_v2", "strategies", "strategy_notes", "trades" diff --git a/memory/.pgschemaignore b/memory/.pgschemaignore index 5b991f1..308db45 100644 --- a/memory/.pgschemaignore +++ b/memory/.pgschemaignore @@ -21,11 +21,16 @@ patterns = [ # --- victoria_memory trading-desk domain tables --- # Victoria's chess-themed trading pipeline book of record. # Dropping these destroys her entire trading operation state. + "asset_classes", "cash_ledger", "instruments", + "open_orders", + "order_adjustments", "portfolio_asset_classes", + "portfolio_snapshots", "portfolios", "positions", + "price_cache_v2", "strategies", "strategy_notes", "trades"