The hardcoded _DB_RESET_TABLES tuple had drifted — session_profile, smtp_targets, and webhook_subscriptions were all missing, so `decnet db-reset --i-know-what-im-doing drop-tables` silently left them behind. Running it on a post-webhook install then letting SQLModel.metadata.create_all() re-create tables produced a partial schema: old rows survived, new columns didn't land, and endpoints 500'd on the missing columns (e.g. auto_disabled_at after the circuit breaker merge). Replace the hardcoded list with `SQLModel.metadata.sorted_tables`, reversed for DROP safety (children first). Any future model addition is auto-enrolled — no manual step, no more drift. No behavior change on reset semantics; the SET FOREIGN_KEY_CHECKS=0 fence still covers any edge case the sort order misses.
5.4 KiB
5.4 KiB