| name | pg-pull |
| description | Use to pull the Heroku production database down into a new local PostgreSQL database and point the app at it. Fires on /pg-pull or when the user asks to refresh local data from production. |
| version | 1.0.0 |
Heroku PG Pull
Pull the Heroku production database down into a new local PostgreSQL database and update the app to use it.
Prerequisites — tell the user this first
Before doing anything else, output this message to the user:
Before we continue: make sure you're logged in to Heroku on the terminal.
Run heroku login if you haven't already this session. Once you're logged in, let me know and I'll proceed.
Wait for the user to confirm they are logged in before continuing.
Step 1 — Detect current DB and propose next name
Read config/database.yml and find the database: value under the development: section. This will be something like everycent_dev_5.
- Parse the trailing number (e.g.
5)
- Increment it by 1 to get the proposed next DB name (e.g.
everycent_dev_6)
Tell the user:
Current dev DB: everycent_dev_5
Proposed new DB: everycent_dev_6
Proceed with this name, or enter a different one?
Wait for confirmation or a custom name before continuing.
Step 2 — Pull from Heroku
Run the pull command using the confirmed DB name:
heroku pg:pull DATABASE_URL <confirmed-db-name> --app everycent
This will take a moment. Errors about _heroku schema or transaction_timeout are expected and harmless — Heroku-internal infrastructure that doesn't exist locally.
Step 3 — Update database.yml
Edit config/database.yml and replace the database: value under development: with the new DB name.
Step 4 — Check migration status
Run:
rails db:migrate:status
Report any migrations that are down — those will need to be run. If all are up, say so.
Step 5 — Verify data freshness
Run:
rails runner "puts Transaction.maximum(:transaction_date)"
Report the date back to the user as a data freshness signal. A recent date confirms the pull captured up-to-date production data.
Done
Summarise:
- New DB name
- Migration status (all up / N down)
- Last transaction date
The spending-analysis skill reads the dev DB name from config/database.yml automatically, so no skill edit is needed after a pull.