djangocms-picture icon indicating copy to clipboard operation
djangocms-picture copied to clipboard

fix: added missing migrations

Open vasekch opened this issue 1 year ago • 6 comments

Description

Adding missing migrations for newer Django (couldn't find particular version, but migrations for OneToOneField are generated with a slight difference).

# older django - currently in migrations
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='djangocms_picture_picture', primary_key=True, serialize=False, to='cms.CMSPlugin'),

# new django v4.1 - in this PR
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='%(app_label)s_%(class)s', serialize=False, to='cms.cmsplugin'),

Related resources

  • https://github.com/django-cms/djangocms-picture/pull/118
  • https://github.com/django-cms/djangocms-picture/issues/122
  • the same migration in project django-cms/djangocms-file https://github.com/django-cms/djangocms-file/blob/master/djangocms_file/migrations/0012_alter_file_cmsplugin_ptr_alter_folder_cmsplugin_ptr.py

Checklist

  • [x] I have opened this pull request against master
  • [ ] I have added or modified the tests when changing logic
  • [ ] I have followed the conventional commits guidelines to add meaningful information into the changelog
  • [x] I have read the contribution guidelines and I have joined #workgroup-pr-review on Slack to find a “pr review buddy” who is going to review my pull request.

vasekch avatar May 04 '23 09:05 vasekch

this is a duplicate with #118 and actually I don't like the migration dependency being last cms migration from v4, that breaks backward compatibility

will try to improve this

vasekch avatar May 04 '23 15:05 vasekch

Changed migration dependency to the first migration of CMS

newer Django treat migrations for OneToOneField with a slight difference (couldn't find particular version where this change occurs)

It seems sensible to update migrations to the newer standard.

# older django - currently in migrations
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='djangocms_picture_picture', primary_key=True, serialize=False, to='cms.CMSPlugin'),

# new django (tested in v4.1.8) - in this PR
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='%(app_label)s_%(class)s', serialize=False, to='cms.cmsplugin'),

vasekch avatar May 04 '23 16:05 vasekch

Changed migration dependency to the first migration of CMS

What is the reason for that?

mogoh avatar Jul 10 '23 14:07 mogoh

Changed migration dependency to the first migration of CMS

What is the reason for that?

It seems to me, that it brings more independence in version of DjangoCMS as the latest migrations may not be present in older versions.

vasekch avatar Jul 17 '23 15:07 vasekch

Thanks @marksweb and @fsbraun for the lesson :man_student:

vasekch avatar Jul 18 '23 10:07 vasekch

Thanks @marksweb and @fsbraun for the lesson 👨‍🎓

Thanks for contributing. I went looking for this migration trick again and I think it's undocumented. Just one of those things you pick up from people that have found it from others I think.

marksweb avatar Jul 18 '23 10:07 marksweb