3 ms·
DB migrations should definitely not be done interactively and definitely not in an SSH session. Write them beforehand, have them reviewed with the rest of the c
by vasco 4y ago
DB migrations should definitely not be done interactively and definitely not in an SSH session. Write them beforehand, have them reviewed with the rest of the code, and have your deployment process run them.
- PedroBatista 4y agoAgree, but in the real world that works 100% most of the time.
- ranting-moth 4y ago100% most of the time. One of those rare cases when I laugh out loud at a HN comment. I'm definitely stealing this phrase!
- phamilton 4y agoJust to clarify our process: DB migrations are part of code review, they run as a script, but we don't have that script run automatically as part of CD. We've been bit by enough migration surprises that we require someone watching and able to interrupt and cancel the migration if needed. But that's the extent of action required. Run this command, Ctrl-C if necessary. Definitely not YOLO'ing in a psql in prod.
- vasco 4y agoThat's a really good process that scales forever even if you have a good person for it. Once you want to have more people do it, I find it easier to have hard-coded timeouts that cancel and rollback if the migration will be locked. I've also done auto rollback in these cases.