main
main copied to clipboard
Change database setup on heroku
Currently we've got the same database being used by staging and production. That's a terrible idea, the staging one should be a mirror / backup of production, but NOT the exact same database.
We also should setup regular backups of the database.
And remove Harpo's zipcode records since that's costing us $30 a month.
Hey, I don’t have permissions to create new paid resources.
What we need to do is create a new database in production, or detach the staging database and use it only in production (I don’t know if this is possible tho).
Once the new database is created I can take it from there. This will be the following steps:
To copy the original to the new one:
heroku pg:copy ORIGINAL_DB_NAME NEW_DB_NAME --app advocacycommons
Then update the env variable of the production environment database to use the new database.
To copy the production database to the staging one: heroku pg:copy advocacycommons::DB_NAME STAGING_DB_NAME --app staging-advocacycommons
REFERENCE: https://devcenter.heroku.com/articles/heroku-postgres-backups#direct-database-to-database-copies
I have admin access and can do this. @rabble, assign to me if you want me to go ahead.
go for it @harpojaeger
Re: the zipcodes thing, I'm assuming it's fine to just drop that table altogether?
Bugger, it turns out it won't let me add paid add-ons. @rabble if you can provision a new DB on production we'll hand this back to @agustinrhcp. I already dropped the ZIP table and ran a full DB backup on staging.
I set up staging DB daily backups too and can do the same for production once it's created.
I'm taking this ticket out of the current sprint and putting it back into backlog. two reasons: We haven't touched it in two weeks, so it's clearly not that critical, and more importantly we should probably just get rid of staging entirely.
@rabble let's make a firm decision: shall we drop "Staging", or not?