Settings

Theme

Ask HN: How do you deploy code with breaking database changes?

1 points by qd011 2 years ago · 2 comments · 1 min read

Reader

Deploying new code which relies on a non-backward-compatible database changes - how do you update the application and the database without any downtime?

What tools and processes do you use for this? Are there any established best practices?

For more context, I'm using a managed SQL database and the application runs on Kubernetes.

gigatexal 2 years ago

Generally if you take the always append columns never drop or rename existing ones you’ll be okay. (Then once everyone moves over to the new stuff you can drop or otherwise cleanup the table).

Make alter table statements, depending on the engine some can be non-locking/blocking.

Deploy code.

Enjoy.

UK-Al05 2 years ago

Normally all breaking changes can be broken up into 2.

First add the additions to the db, then the new version of the software can work with the db.

Then once all software is updated, remove the old fields.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection