Fix wagtailembeds thumbnail_url migration for MySQL 8.0.13 (#6999)

* Upgrade mysql to 8.0.23 for github actions

* Fix thumbnail_url migration to work on Django 3 / MySQL 8.0.13+

Work around https://code.djangoproject.com/ticket/32503 by applying the not-null constraint before converting to TextField.
pull/6980/head
Matt Westcott 2021-04-16 20:41:32 +01:00 zatwierdzone przez GitHub
rodzic 88cebcd43a
commit f2be408f62
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -125,7 +125,7 @@ jobs:
services:
mysql:
image: mysql:5.7
image: mysql:8.0.23
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: wagtail

Wyświetl plik

@ -24,13 +24,24 @@ class Migration(migrations.Migration):
name="url",
field=models.TextField(),
),
# Converting URLField to TextField with a default specified (even with preserve_default=False)
# fails with Django 3.0 and MySQL >=8.0.13 (see https://code.djangoproject.com/ticket/32503) -
# work around this by altering in two stages, first making the URLField non-null then converting
# to TextField
migrations.AlterField(
model_name="embed",
name="thumbnail_url",
field=models.TextField(
field=models.URLField(
blank=True,
default="",
),
preserve_default=False,
),
migrations.AlterField(
model_name="embed",
name="thumbnail_url",
field=models.TextField(
blank=True,
),
),
]