Open aoxborrow opened 6 years ago
Thanks for this. Looks like the Django 1.0 stuff needs to get dropped out.
This changes the first migrations file. Do these not need to be in a new migration so that existing systems will upgrade properly, or is this just making explicit the previous defaults?
good question. I'm not really sure, I just grabbed this commit from @dcollinsn. CASCADE
was the default in Django < 2.0, but I don't think on_delete
actually changes anything at the database level, so this should be fine?
I just migrated an older Django project, and it looks like you do need to update the original migration files, they simply won't run in Django 2.0. See ticket here: https://code.djangoproject.com/ticket/28677
And in Django 1.9 release notes:
Update models and existing migrations to explicitly set the argument.
https://docs.djangoproject.com/en/dev/releases/1.9/#foreignkey-and-onetoonefield-on-delete-argument
Since on_delete
doesn't affect anything at the database level, it's fine to just edit them like this. If you want to be 100% proper you could create a new migration with Django 2.0, then squash them together, effectively creating the same migration seen here.
closes #25