3 ms·
That's why I prefer idempotent SQL DDL updates. A disk full of up/down scripts makes me nervous. Most folks test their up scripts. They almost NEVER adequately
by ttfkam 5y ago
That's why I prefer idempotent SQL DDL updates. A disk full of up/down scripts makes me nervous.
Most folks test their up scripts. They almost NEVER adequately test their down scripts, so you're left with this false sense of security moving forward even though revision 63 of 64 has a bug in the down portion…which you only find when you're trying to revert to the state of rev 60.
As for ORM migrations, of course they work. They've dumbed down your use of the database to the lowest common denominator (looking at you, MySQL).
IF EXISTS and IF NOT EXISTS are your good friend. Run the script, the database will be at the target state. When all databases are past a certain point, remove the appropriate ALTER TABLE IF EXISTS ADD COLUMN statements.
Makes source diffing much easier, is a consistent single source of truth, and allows for pruning old parts as needed.