Summary
Some routes use get_db() (raw SQLite via g._database) while UserManager.log_post() writes through a separate abstraction (likely a Postgres-backed connection). Affected routes: api_post_history, api_scheduled_posts, api_delete_post.
Impact
On Railway (Postgres), these routes will read from SQLite and write to Postgres, or vice versa. Post history will appear empty or double-write depending on the runtime environment. Nearly impossible to reproduce in local dev.
Fix
Pick one database abstraction (recommend modules/db.py Postgres path) and migrate all routes to use it. Remove get_db() / g._database once fully migrated.
Effort: 1–2 days
Part of full audit: #1
Summary
Some routes use
get_db()(raw SQLite viag._database) whileUserManager.log_post()writes through a separate abstraction (likely a Postgres-backed connection). Affected routes:api_post_history,api_scheduled_posts,api_delete_post.Impact
On Railway (Postgres), these routes will read from SQLite and write to Postgres, or vice versa. Post history will appear empty or double-write depending on the runtime environment. Nearly impossible to reproduce in local dev.
Fix
Pick one database abstraction (recommend
modules/db.pyPostgres path) and migrate all routes to use it. Removeget_db()/g._databaseonce fully migrated.Effort: 1–2 days