Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid possible migration failure #680

Closed
wants to merge 1 commit into from
Closed

Conversation

Honza-m
Copy link

@Honza-m Honza-m commented Jun 30, 2021

Django migrations are applied in random order unless a dependency is specified. This file specifies dependency to the first migration of the cms module, however it also requires the cms.Placeholder model which is only defined in subsequent migration files of the cms module. This means that if Django decides to only apply the first migration of the cms module, followed by the first migration of the djangocms_blog module (which is valid since there are no further dependencies), the migration process will fail because cms.CMSPlugin has not been created yet. This happens in my project all the time. The proposed change ensures that all cms migrations are finished before djangocms_blog migrations start, hence enabling the migration process to succeed.

Django migrations can be applied in random order unless a dependency is specified. This file specifies dependency to the first migration of the cms module, however it also requires the cms.Placeholder model which is only defined in subsequent migration files of the cms module. This means that if Django decides to only apply the first migration of the cms module, followed by the first migration of the djangocms_blog module (which is valid since there are no further dependencies), the migration process will fail because cms.CMSPlugin has not been created yet. This happens in my project all the time. The proposed change ensures that all cms migrations are finished before djangocms_blog migrations start, hence enabling the migration process to succeed.
@yakky
Copy link
Member

yakky commented Jul 28, 2022

@Honza-m thanks a lot for your suggestion. You are right stating that "first" is not a good migration dependency declaration, but I have been burnt a few times by "latest" too. I think it's safe to pick a reasonable actual django CMS migration to depend on. A good candidate it's "0022_auto_20180620_1551" which is part of django CMS 3.7 which the oldest version we support as of now

@yakky
Copy link
Member

yakky commented Apr 20, 2023

@Honza-m this has been fixed in #722 by replacing first with a proper django-cms migration

Thanks a lot for your suggestion

@yakky yakky closed this Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants