4 ms·
Interesting comparing this to Ruby on Rail's ORM, which takes a relatively hands-off approach. ActiveRecord will produce a migration for you when you generate a
by thedanbob 6y ago
Interesting comparing this to Ruby on Rail's ORM, which takes a relatively hands-off approach. ActiveRecord will produce a migration for you when you generate a model from the command line, but otherwise migrations are entirely the developer's responsibility. And the way he suggests handling patches sounds a lot like how ActiveRecord does it: keep track of what migrations have already been applied and only apply newer ones, and for a new database just create the up-to-date schema rather than applying the entire history of migrations.
- bb88 6y ago> keep track of what migrations have already been applied and only apply newer ones The Django migration system does this for you, and it does it really well.
- _AzMoo 6y agoThere's nothing stopping you from hand-writing Django migrations if you choose. Django compares the state of the models to the state of the database after all migrations have been run to determine if new migrations are necessary, so as long as you've covered all of your model changes in your hand-rolled migration you'll be fine.
- thedanbob 6y agoAh, good to know. I have no experience with Django and the article gave me the impression that Django migrations can’t be handled manually.
- GlennS 6y agoAll these systems are patch based systems (for an alternative approach see the comment in this thread from the Migra developer). However, he is suggesting the patches should be written in SQL. By default in Django the patches are written in Python, which is then used to automatically SQL.