#23577: Rename operations should rename indexes, constraints, sequences and
triggers named after their former value
---------------------------------+------------------------------------
     Reporter:  Chris Woytowitz  |                    Owner:  (none)
         Type:  Bug              |                   Status:  new
    Component:  Migrations       |                  Version:  dev
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------

Comment (by Fabian Pottbäcker):

 I just ran into a similar Issue when reverting migrations on Postgres,
 specifically I have the following condensed and abstracted migration
 history:

 1. Setup:
   1. Create model Author
   2. Create model Book (`author = ForeignKey(Author)`)
 2. Introduce PenNames
   1. Create model PenName
   2. Alter `Book.author` to allow null
   3. Add `author_new = ForgeignKey(PenName, null=True)` to book
   4. RunPython to create PenNames for all authors and set `author_new`
 accordingly (including a corresponding reverse operation)
   5. Drop `Book.author`
   6. Alter `Book.author_new` to prohibit null
   7. Rename `Book.author_new` to `Book.author`
 3. Remove PenNames (for whatever reason)
   1. Some Operation to repopulate `Book.author`
   2. Drop column `Book.author`

 After successfully applying these migrations, reverting to State 1 will
 error when undoing step 2.5, since the index `book_author_id...` was
 already created when undoing step 3.2, but it would be called
 `book_author_new_id...` when applying these migrations forwards.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/23577#comment:38>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ad67b7369-fb17d4cd-7332-4232-bde0-511f7b1a53b8-000000%40eu-central-1.amazonses.com.

Reply via email to