Curious what others are doing for db schema migrat...
# ask-metaflow
a
Curious what others are doing for db schema migration best practices? Would it be acceptable to have a cron job to check the metadata service api
/db_schema_status
endpoint and see if
is_up_to_date
is set to
False
. If it, then send an API request to the
/upgrade
endpoint?
1
f
DB migrations are quite rare (fortunately) so I don't really think you need to worry about something automatic like that – plus, beforehand you'll likely want to take a backup of the DB which will allow you to roll back if anything goes wrong There's also some extra precautions you'll likely want make if you're using a logical replica DB, since migrations can potentially break replication slots
a
Thanks @fresh-laptop-72652 for the helpful advice. Custom backups are enabled for our RDS cluster so we are good on that front.
f
if you're referring to the automated RDS backups, you'd likely want to create another manually right before the upgrade/migration. if you imagine running an upgrade late in the day, something goes wrong and you need to restore from the most recent snapshot, you could potentially lose the difference in that day's data
a
Makes sense, thanks. Was referring to our own internal custom tools for creating backups on an hourly basis that our dedicated DB team developed.
f
nice! that's a lot of backups 😅
a
The latest backup supersedes the old one 🙂
f
lol yea I meant more that for nontrivial DB sizes 1hr for full backups is quite high and could result in performance implications – I think typical RDS behavior is 1 per day during a window, plus incremental snapshots every 5min (7d retention period) anyways, metaflow is quite lightweight and sounds like you're in good hands 🙂
thankyou 1
a
Ahh ok good points. We can adjust the db automation tools accordingly. I think our current settings are backup once every hour, hourly retention is 2, hourly retention for disaster recovery is 24