#26476: Migration preserve_default does not works properly? -------------------------------------+------------------------------------- Reporter: madEng84 | Owner: nobody Type: Bug | Status: closed Component: Migrations | Version: 1.8 Severity: Normal | Resolution: invalid Keywords: preserve_default | Triage Stage: sqlmigrate | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by shaib):
* status: new => closed * resolution: => invalid Comment: If table `my_app_label` is not empty when you run this migration, and you try to add a non-null column without a default, your database should give an error. This is why Django uses a default in the transaction. Your reading of the documentation is a bit too literal -- or, arguably, the documentation is not clear enough; what is meant is that Django never '''leaves''' defaults in the database. Indeed, for large databases the aler-table queries (well, the first) could be quite heavy. I am not aware of a light way to add a non-nullable column to a large table. In the future, please ask "is this a bug" type questions on a users' forum, such as the #django IRC channel or django-users mailing list. -- Ticket URL: <https://code.djangoproject.com/ticket/26476#comment:3> 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/066.e9ccccde627335cd44056b8a241aff6b%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.