Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Fix slug overflow in MySQL with strict mode enabled #70

Merged
merged 7 commits into from
Nov 28, 2017
Merged

Conversation

sevein
Copy link
Member

@sevein sevein commented Nov 24, 2017

The issue was originally reported by @scollazo here: artefactual/archivematica#792. It's an error seen in recent versions of MySQL where the strict mode comes enabled by default.

And bumped version to 1.7.4.

Our initial migration test only covered SQLite. We found later that AM17
deployments making use of MySQL in strict mode (the default in recent releases)
failed:

    django.db.utils.DataError: Problem installing fixture '/home/travis/build/artefactual/archivematica-fpr-admin/fpr/migrations/pronom_92.json': Could not load fpr.Format(pk=None): (1406, "Data too long for column 'slug' at row 1")

Django's CharField validator doesn't seem to kick in during the migration - I
suspect this is not a bug in Django but it django-autoslug's AutoSlugField
which subclasses the former.
@sevein sevein added the WIP label Nov 24, 2017
@qubot qubot force-pushed the dev/slug-50 branch 2 times, most recently from 2580543 to c37dc8a Compare November 24, 2017 21:49
The fixture had some values that could cause an overflow in certains RBDMS like
MySQL in strict mode.
@sevein sevein requested a review from jrwdunham November 24, 2017 22:01
@sevein sevein removed the WIP label Nov 24, 2017
@sevein sevein added this to the 1.7.4 milestone Nov 24, 2017
Ensure that the custom slug generator function truncates the final value
based on the max_length property of the field.
@sevein
Copy link
Member Author

sevein commented Nov 25, 2017

@jrwdunham this is ready for CR!

@sevein sevein self-assigned this Nov 28, 2017
Copy link
Contributor

@jraddaoui jraddaoui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants