Opened 9 years ago
Last modified 5 years ago
#27417 closed Bug
Migration to change model field case crashes on Oracle — at Version 3
| Reported by: | Vackar Afzal | Owned by: | Zach Zundel |
|---|---|---|---|
| Component: | Migrations | Version: | 1.9 |
| Severity: | Normal | Keywords: | Migrations, Oracle, DB, Rename |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
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.
Change History (3)
comment:1 by , 9 years ago
| Type: | Uncategorized → Bug |
|---|
comment:2 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 9 years ago
| Description: | modified (diff) |
|---|---|
| Easy pickings: | unset |
| Severity: | Release blocker → Normal |
| Summary: | Change case on field causes invalid rename on Oracle backend migration → Migration to change model field case crashes on Oracle |
| Triage Stage: | Unreviewed → Accepted |
Reproduced on master at 373c6c409c310cb61e1e9c9aff4adba379ffd0b4. The error when running the migration is "ORA-00957: duplicate column name".