Opened 9 years ago
Last modified 5 years ago
#27417 closed Bug
Change case on field causes invalid rename on Oracle backend migration — at Initial Version
| Reported by: | Vackar Afzal | Owned by: | nobody |
|---|---|---|---|
| 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
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.