Settings

Theme

Ask HN: What tooling do you use for SQL/DB migrations

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


My team is growing and maturing, and we want to start keeping migrations and changes to the DB structure in a deployable manner. What tooling have you found that works best for this need?

gregjor 2 years ago

We write the migrations in SQL, committed as part of the pull request. Migrations tested on copies of production database along with the code changes. Automatically applied by a script when a pull request gets merged/deployed. No special tooling really, just a couple of SQL files.

We have a SQL preprocessor that lets us refer to environment globals and class constants in SQL, so we're not hard-coding magic numbers and strings in the SQL. It resolves those with reflection on the code and replaces the named globals/constants before sending the SQL to the database.

stop50 2 years ago

since we use django, its own migration works best.

Keyboard Shortcuts

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