|
|
|
Declarative database schema migrations – yay or nay?
|
|
1 points
by astronautas
242 days ago
|
|
Two issues I observed with typical migration as a separate new SQL file approach: * Views don't have alter, so have to be fully redefined. Any change to a view obscures actually changed parts of a view, since you have to fully redefine it. * Duplicate change tracking with git and migration history. Can't we just use git for history? E.g. https://atlasgo.io/. Totally non affiliated with them. Just had a shower idea, but saw it already being implemented (yay). |
|
https://atlasgo.io/versioned/intro
Note how this section of the docs is much longer than the declarative version. One of the hard parts about adopting something like this is that it's easy for new projects, but hard to start using in an existing project.
I've built something similar myself: https://hofstadter.io/getting-started/data-layer/
You always need escape latches when there are things you cannot define in your declarative (DSL). This makes things more mentally and contextually difficult, so most people opt for the simple and clearly understandable.