audio_name = models.TextField(blank=False)
it generates the following migration code:
operations = [
migrations.AlterModelOptions(
name='s3_bucket_audios',
options={},
),
migrations.AlterField(
model_name='s3_bucket_audios',
name='audio_name',
field=models.TextField(help_text='name of the audio in the s3
bucket'),
),
migrations.AlterUniqueTogether(
name='s3_bucket_audios',
unique_together=set(),
),
]
However it that field was being use in a unique condition:
class Meta:
ordering = [ "audio_name"]
unique_together = ('audio_name')
you get the following error:
django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'audio_name'
used in key specification without a key length")
That is because it changes the field type before changing the unique
condition, I think the order should be handled automatically, I had to
change the code manually to:
operations = [
migrations.AlterModelOptions(
name='s3_bucket_audios',
options={},
),
migrations.AlterUniqueTogether(
name='s3_bucket_audios',
unique_together=set(),
),
migrations.AlterField(
model_name='s3_bucket_audios',
name='audio_name',
field=models.TextField(help_text='name of the audio in the s3
bucket'),
),
]
It is not a big issue anyway...
Thanks a lot for your amazing work!!
--
Ticket URL: <https://code.djangoproject.com/ticket/31186>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Uncategorized => Bug
Old description:
New description:
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31186#comment:1>
* cc: Markus Holtermann (added)
* status: new => closed
* version: 2.2 => master
* resolution: => wontfix
Comment:
Thanks for this report, however this is a MySQL caveat and I don't think
we can detect that correctly. In the reverse direction (i.e. changing
`TextField` to `CharField` and adding `unique_together`) the operations'
order is correct, `AlterField` and `AlterUniqueTogether`.
--
Ticket URL: <https://code.djangoproject.com/ticket/31186#comment:2>