--- id: backburner/four-foreign-keys-are-over-postgres-s-63 title: "Four foreign keys are over Postgres's 63-character limit and re-create on every `db:push`" theme: backburner status: open created: 2026-08-19 date_source: stated order: 1 --- **Four foreign keys are over Postgres's 63-character limit and re-create on every `db:push`.** Found 2026-08-19 while pushing `chat_notification_prefs`. Not a blocker and not causing trouble: eight extra statements per push, no prompt, no data touched — the same harmless churn already documented for `pk_music_now_playing`, and recorded here only so the next person reading a push plan knows it is not their change. command_hq_session_tags_session_row_id_command_hq_sessions_id_fk 64 command_hq_watcher_fires_session_row_id_command_hq_sessions_id_fk 65 bitcoin_wallet_frozen_utxos_wallet_id_bitcoin_wallet_wallets_id_fk 66 bitcoin_wallet_chain_cache_wallet_id_bitcoin_wallet_wallets_id_fk 65 The fix is the one `src/databases/CLAUDE.md` already prescribes and these four missed — declare them with `foreignKey({ name: 'fk_…', … })` under 63 characters, exactly as `fk_user_integrations_server_integration` was. **Renaming a constraint is not a data change**, but it does mean one push where the old name drops and the new one is added, so do it deliberately rather than folded into an unrelated change. Note the two bitcoin-wallet ones live in that plugin's own repository (`plugins/bitcoin-wallet/db/schema.ts`), so this spans two repos and the plugin half only churns on a host where that plugin is installed.