#24184: Migrate auto-fake behavior is not safe --------------------------------------+------------------------ Reporter: carljm | Owner: nobody Type: Bug | Status: new Component: Migrations | Version: 1.7 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | --------------------------------------+------------------------ Currently, `manage.py migrate` will auto-fake-apply initial migrations if it sees that the tables already exist, but it doesn't do any checking that the schema of those tables actually matches the schema that the migration would have created. And our documentation doesn't call out the importance of making sure that your existing schema matches the models you used to generate the initial migrations.
In an ideal world, we might keep the current behavior and automatically verify a full schema match before auto-faking, but I doubt that's feasible and in any case would be a major new feature. Short of that, I think the unsafe auto-fake behavior should not be the default; it should require a flag like `--fake-if-exists` or something (needs bikeshedding) to turn it on. Wherever that flag is documented/demonstrated in the docs (e.g. in the [[https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from- south upgrade-from-South docs]]), we should be very clear that it is only safe to use if you are sure that your schema is properly up-to-date with your models used to generate your initial migration. (This ticket was motivated by #24178.) -- Ticket URL: <https://code.djangoproject.com/ticket/24184> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/049.c8bcd3c1444ee54506229105921f8b6d%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.