4 ms·
For one, the database is the only place where the entire schema is maintained. That may be true for rails, but not for most other ORMs that don't follow the AR
by moe 16y ago
For one, the database is the only place where the entire schema is maintained.
That may be true for rails, but not for most other ORMs that don't follow the AR pattern. Said other ORMs take authority over the schema, which means by default they will sync the database to match your code - although the degree to which that is enforced is usually configurable.
If I need to go add an index to a production system
Then you will of course either test the change on a staging system first, or quickly backport the change after the hotfix. Whether the backport is done through a rails migration or a django model-change is not relevant to this discussion.
You might inherit a database/schema from someone else
Red herring. It's a rare case and people have managed this scenario with ORMs other than AR just fine since long before Rails was conceived.
Migration generation via diffing schemas? That's a much harder, in fact provably intractable problem!
A wide range of tools has a pretty good handle on this problem.
(sqldelta.com, postfacto.org, xsql, red-gate.com, etc.)
Ambiguous changes are pretty rare during the evolution of your average webapp schema. Machines can very well solve 99% of cases on their own, and smartly interrogate the user for the rest.