#27417: Migration to change model field case crashes on Oracle
-------------------------------------+-------------------------------------
     Reporter:  Vackar Afzal         |                    Owner:  Zach
                                     |  Zundel
         Type:  Bug                  |                   Status:  assigned
    Component:  Migrations           |                  Version:  1.9
     Severity:  Normal               |               Resolution:
     Keywords:  Migrations, Oracle,  |             Triage Stage:  Accepted
  DB, Rename                         |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * severity:  Release blocker => Normal
 * easy:  1 => 0
 * stage:  Unreviewed => Accepted


Old description:

> Given the following class
>
> {{{
> class MyModel(models.model):
>     somefield = models.CharField(max_length=100)
> }}}
>
> if I rename 'somefield' to 'someField' and run make migrations, it will
> generate a migrations that will rename 'somefield' to 'someField'
>
> On case insensitive backends like oracle, this will result in the
> following invalid SQL being generated.
>

> {{{
> alter table mymodel rename somefield to someField;
> }}}
>
> In cases like this, it should simply generate no SQL.
>
> The other option is when prompted for 'did you rename field x to y' , you
> can say no, which will result in a drop column followed by an add column,
> but this will result in **all of the existing data in the column being
> lost**, less than ideal.

New description:

 Given the following class

 {{{
 class MyModel(models.Model):
     somefield = models.CharField(max_length=100)
 }}}

 if I rename 'somefield' to 'someField' and run make migrations, it will
 generate a migrations that will rename 'somefield' to 'someField'

 On case insensitive backends like oracle, this will result in the
 following invalid SQL being generated.


 {{{
 alter table mymodel rename somefield to someField;
 }}}

 In cases like this, it should simply generate no SQL.

 The other option is when prompted for 'did you rename field x to y' , you
 can say no, which will result in a drop column followed by an add column,
 but this will result in **all of the existing data in the column being
 lost**, less than ideal.

--

Comment:

 Reproduced on master at 373c6c409c310cb61e1e9c9aff4adba379ffd0b4. The
 error when running the migration is "ORA-00957: duplicate column name".

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

Reply via email to