Skip to content

Commit

Permalink
Fix migrations failures caused by changed revision / initial dependen…
Browse files Browse the repository at this point in the history
…cy change
  • Loading branch information
zerolab committed Sep 19, 2022
1 parent a94fef2 commit ed6aa02
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
13 changes: 5 additions & 8 deletions wagtail_localize/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@
from django.db import migrations, models
import django.db.models.deletion
from wagtail import VERSION as WAGTAIL_VERSION
from wagtail_localize.compat import get_revision_model


class Migration(migrations.Migration):

initial = True

core_migration = (
"0076_modellogentry_revision"
if WAGTAIL_VERSION >= (4, 0)
else "0057_page_locale_fields_notnull"
)
dependencies = [
("wagtailcore", core_migration),
("wagtailcore", "0057_page_locale_fields_notnull"),
("contenttypes", "0002_remove_content_type_name"),
]

if WAGTAIL_VERSION >= (4, 0):
run_before = [("wagtailcore", "0069_log_entry_jsonfield")]

operations = [
migrations.CreateModel(
name="String",
Expand Down Expand Up @@ -154,7 +151,7 @@ class Migration(migrations.Migration):
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=get_revision_model(),
to="wagtailcore.PageRevision",
),
),
(
Expand Down
36 changes: 36 additions & 0 deletions wagtail_localize/migrations/0016_wagtail4_revision_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import django.core.validators
from django.db import migrations, models

from wagtail import VERSION as WAGTAIL_VERSION


if WAGTAIL_VERSION >= (4, 0):

class Migration(migrations.Migration):

dependencies = [
("wagtail_localize", "0015_translationcontext_field_path"),
("wagtailcore", "0076_modellogentry_revision"),
]

operations = [
migrations.AlterField(
model_name="TranslationLog",
name="page_revision",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailcore.Revision",
),
)
]

else:

class Migration(migrations.Migration):

dependencies = [("wagtail_localize", "0015_translationcontext_field_path")]

operations = []

0 comments on commit ed6aa02

Please sign in to comment.