#24407: Initial migration fails if app name has upper-case letters ----------------------------+-------------------- Reporter: CarstenF | Owner: nobody Type: Bug | Status: new Component: Migrations | Version: 1.7 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 1 Easy pickings: 0 | UI/UX: 0 ----------------------------+-------------------- In a Django project that was created pre-1.7, did ''not'' use South before and was recently upgraded to Django 1.7.4 and is otherwise fine, I was trying to convert it to use migrations, following the docs at https://docs.djangoproject.com/en/1.7/topics/migrations/#adding- migrations-to-apps
Creating the initial migrations with `makemigrations` went well, but the first run of `migrate` aborted with error "django.db.utils.DatabaseError: ORA-00955: name is already used by an existing object". Please see my post to django-users at https://groups.google.com/forum/#!topic/django- users/lVS24BGFouo for details. Debugging this quickly brought me to `MigrationExecutor.detect_soft_applied()` in `django/db/migrations/executor.py`, whose lines 153 to 154 say: {{{ #!python if model._meta.db_table not in self.connection.introspection.get_table_list(self.connection.cursor()): return False }}} It seems that `get_table_list()` returns all lower-case list items, whereas `model._meta.db_table` was, in my case, "Lori_aub". Consequently, `False` was wrongly returned. Adding `lower()`, i.e. changing this to {{{ #!python if model._meta.db_table.lower() not in self.connection.introspection.get_table_list(self.connection.cursor()): return False }}} entirely fixed the problem for me! :-) (Sorry for not having a PR readily available.) -- Ticket URL: <https://code.djangoproject.com/ticket/24407> 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/051.553b70887d2204d3287505ae8b91a5a2%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.