Fiddle max_length in focal_point_key migrations to make them superficially different

This prevents the migration engine from optimising them away - see https://github.com/wagtail/wagtail/pull/3293#issuecomment-274828807
pull/3300/head
Matt Westcott 2017-01-25 12:53:42 +00:00
rodzic 25f57d0636
commit 3f433cb221
4 zmienionych plików z 12 dodań i 6 usunięć

Wyświetl plik

@ -63,7 +63,7 @@ class Migration(migrations.Migration):
('file', models.ImageField(width_field='width', upload_to='images', height_field='height')),
('width', models.IntegerField(editable=False)),
('height', models.IntegerField(editable=False)),
('focal_point_key', models.CharField(editable=False, max_length=16, null=True)),
('focal_point_key', models.CharField(editable=False, max_length=18, null=True)),
('filter', models.ForeignKey(on_delete=models.CASCADE, related_name='+', to='wagtailimages.Filter')),
('image', models.ForeignKey(on_delete=models.CASCADE, related_name='renditions', to='wagtailimages.Image')),
],

Wyświetl plik

@ -44,6 +44,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='rendition',
name='focal_point_key',
field=models.CharField(blank=True, default='', max_length=16, editable=False),
field=models.CharField(blank=True, default='', max_length=18, editable=False),
),
]

Wyświetl plik

@ -35,6 +35,12 @@ class Migration(migrations.Migration):
# that successfully applied the old 1.8 version of this migration are consistent with
# other setups.
#
# Since Django will optimise away any AlterField operations that appear to match
# the current state (according to earlier migrations) - which would cause them to be
# skipped on installations that ran the earlier (max_length=255) versions of the
# migrations - we need to make them superficially different; we do this by stepping
# max_length down from 18 to 17 then 16.
#
# Projects with a custom image model don't have to worry about this - they'll have an existing
# migration with the max_length=255, and will get a new migration reducing it to max_length=16
# the next time they run makemigrations.
@ -42,7 +48,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='rendition',
name='focal_point_key',
field=models.CharField(blank=True, default='', max_length=16, editable=False),
field=models.CharField(blank=True, default='', max_length=17, editable=False),
),
migrations.AlterUniqueTogether(

Wyświetl plik

@ -13,9 +13,9 @@ class Migration(migrations.Migration):
operations = [
# The Wagtail 1.8 version of migration wagtailimages/0016 did not include the
# step to reduce focal_point_key's max_length to 16, necessary to make it work
# on some MySQL configurations. This migration serves only to ensure that
# installations upgrading from 1.8 to >=1.8.1 have this change applied; on other
# setups (where the current 0016 and 0017 are applied together), this is a no-op.
# on some MySQL configurations. This migration (added in 1.8.1) ensures that
# installations that were already successfully running 1.8 receive this change
# on upgrading to 1.8.1 or later.
migrations.AlterField(
model_name='rendition',
name='focal_point_key',