From e31b26c4dbc3b851a562a70a2365b7187d3a0b33 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Tue, 6 Sep 2016 13:58:38 +0100 Subject: [PATCH] Eliminate dependencies on `__latest__` migrations See https://groups.google.com/d/msg/wagtail/a1lbdKe-QPk/GefsBFnRBgAJ - using __latest__ prevents us from ever applying migrations that are subsequently added to the referenced apps, since logically those migrations must have been applied before the current one (which they weren't, because they didn't exist). This logic is enforced as of Django 1.10. --- CHANGELOG.txt | 1 + docs/releases/1.7.rst | 21 +++++++++++++++++++ .../home/migrations/0001_initial.py | 2 +- .../wagtaildocs/migrations/0001_initial.py | 2 +- .../wagtailimages/migrations/0001_initial.py | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 3cbffed63..f5b68596f 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -18,6 +18,7 @@ Changelog * Added ability to limit access to form submissions (Mikalai Radchuk) * Added the ability to configure the number of days search logs are kept for (Stephen Rice) * Fix: Migrations for wagtailcore and project template are now reversible (Benjamin Bach) + * Fix: Migrations no longer depend on wagtailcore and taggit's `__latest__` migration, logically preventing those apps from receiving new migrations (Matt Westcott) * Fix: The default image format label text ('Full width', 'Left-aligned', 'Right-aligned') is now localised (Mikalai Radchuk) * Fix: Text on the front-end 'password required' form is now marked for translation (Janneke Janssen) * Fix: Text on the page view restriction form is now marked for translation (Luiz Boaretto) diff --git a/docs/releases/1.7.rst b/docs/releases/1.7.rst index 2093813b0..9e47b459c 100644 --- a/docs/releases/1.7.rst +++ b/docs/releases/1.7.rst @@ -53,6 +53,7 @@ Bug fixes ~~~~~~~~~ * Migrations for wagtailcore and project template are now reversible (Benjamin Bach) + * Migrations no longer depend on wagtailcore and taggit's ``__latest__`` migration, logically preventing those apps from receiving new migrations (Matt Westcott) * The default image format label text ('Full width', 'Left-aligned', 'Right-aligned') is now localised (Mikalai Radchuk) * Text on the front-end 'password required' form is now marked for translation (Janneke Janssen) * Text on the page view restriction form is now marked for translation (Luiz Boaretto) @@ -67,6 +68,26 @@ Bug fixes Upgrade considerations ====================== +Project template's initial migration should not depend on ``wagtailcore.__latest__`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +On projects created under previous releases of Wagtail, the ``home/migrations/0001_initial.py`` migration created by the ``wagtail start`` command contains the following dependency line: + +.. code-block:: python + + dependencies = [ + ('wagtailcore', '__latest__'), + ] + +This may produce ``InconsistentMigrationHistory`` errors under Django 1.10 when upgrading Wagtail, since Django interprets this to mean that no new migrations can legally be added to wagtailcore after this migration is applied. This line should be changed to: + +.. code-block:: python + + dependencies = [ + ('wagtailcore', '0029_unicode_slugfield_dj19'), + ] + + .. _filter_spec_migration: Custom image models require a data migration for the new ``filter_spec`` field diff --git a/wagtail/project_template/home/migrations/0001_initial.py b/wagtail/project_template/home/migrations/0001_initial.py index 094ba4f1c..cdc80819a 100644 --- a/wagtail/project_template/home/migrations/0001_initial.py +++ b/wagtail/project_template/home/migrations/0001_initial.py @@ -7,7 +7,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('wagtailcore', '__latest__'), + ('wagtailcore', '0029_unicode_slugfield_dj19'), ] operations = [ diff --git a/wagtail/wagtaildocs/migrations/0001_initial.py b/wagtail/wagtaildocs/migrations/0001_initial.py index 1ca277820..f0d6c5c74 100644 --- a/wagtail/wagtaildocs/migrations/0001_initial.py +++ b/wagtail/wagtaildocs/migrations/0001_initial.py @@ -11,7 +11,7 @@ import wagtail.wagtailsearch.index class Migration(migrations.Migration): dependencies = [ - ('taggit', '__latest__'), + ('taggit', '0001_initial'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] diff --git a/wagtail/wagtailimages/migrations/0001_initial.py b/wagtail/wagtailimages/migrations/0001_initial.py index b87a212d5..fa88ef387 100644 --- a/wagtail/wagtailimages/migrations/0001_initial.py +++ b/wagtail/wagtailimages/migrations/0001_initial.py @@ -12,7 +12,7 @@ import wagtail.wagtailsearch.index class Migration(migrations.Migration): dependencies = [ - ('taggit', '__latest__'), + ('taggit', '0001_initial'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ]