#24062: Reversing Model names fails!
----------------------------+--------------------
     Reporter:  doepunk     |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  1.7
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 I've run into this problem before. When I make a migration renaming a
 Model and later try to revert to an older migration, it fails. The Model
 is very simple with no foreign keys or other relationships to or from
 other Models. It only contains one TextField and one CharacterField with
 choices. When I try to migrate back after renaming the model, I get the
 following error

 {{{
 django.db.migrations.migration.IrreversibleError: Operation <RenameModel
 new_name='NewModel', old_name='OldModel'> in <migration-name> is not
 reversible
 }}}

 I consider this a bug, because I think renaming a database table to an old
 name should not result in failure.

 Another thing I noticed in that context is that when I originally did the
 makemigrations to the NewModel name, I was asked if I had renamed, the
 OldModel, which is great. However when I ran the migrate, I was told this


 {{{
 The following content types are stale and need to be deleted:

     <app-name> | <old-name>

 Any objects related to these content types by a foreign key will also
 be deleted. Are you sure you want to delete these content types?
 If you're unsure, answer 'no'.
 }}}

 I'm unsure what's going on here. But shouldn't renaming involve the
 automatic deletion of the old name and replacing the foreign keys with the
 new database table keys? All without a need for confirmation. Or at least
 if there are no foreign keys as in my case, the confirmation seems
 unnecessary and it only makes it harder to run the migration unsupervised.

--
Ticket URL: <https://code.djangoproject.com/ticket/24062>
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/050.e67ca43cf1e444b087ff09c1d36d9df1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to