|
| 1 | +# Generated by Django 5.2.7 on 2025-10-06 13:50 |
| 2 | +# |
| 3 | +# This migration updates the help_text for the `users` and `teams` ManyToManyField |
| 4 | +# on the ObjectRole model to add trailing periods for consistency. |
| 5 | +# |
| 6 | +# WHY DJANGO 5 CREATES THIS BUT DJANGO 4 DOES NOT: |
| 7 | +# |
| 8 | +# Django 4's migration detector has a bug/limitation where it does not properly detect |
| 9 | +# help_text changes on ManyToManyField instances that use custom `through` tables. |
| 10 | +# The help_text was updated in the model code (ansible_base/rbac/models/role.py:518, 525) |
| 11 | +# to add trailing periods, but Django 4's makemigrations did not detect this change. |
| 12 | +# |
| 13 | +# Django 5 improved its field state serialization and comparison logic for ManyToManyFields, |
| 14 | +# particularly for fields with through tables, and now properly detects these help_text changes. |
| 15 | +# |
| 16 | +# This is a harmless migration that only updates field metadata (help_text) and does not |
| 17 | +# modify the database schema or affect data. |
| 18 | + |
| 19 | +from django.conf import settings |
| 20 | +from django.db import migrations, models |
| 21 | + |
| 22 | + |
| 23 | +class Migration(migrations.Migration): |
| 24 | + |
| 25 | + dependencies = [ |
| 26 | + ('dab_rbac', '0008_remote_permissions_cleanup'), |
| 27 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
| 28 | + migrations.swappable_dependency(settings.ANSIBLE_BASE_TEAM_MODEL), |
| 29 | + ] |
| 30 | + |
| 31 | + operations = [ |
| 32 | + migrations.AlterField( |
| 33 | + model_name='objectrole', |
| 34 | + name='teams', |
| 35 | + field=models.ManyToManyField(help_text='Teams or groups who have access to the permissions defined by this object role.', related_name='has_roles', through='dab_rbac.RoleTeamAssignment', through_fields=('object_role', 'team'), to=settings.ANSIBLE_BASE_TEAM_MODEL), |
| 36 | + ), |
| 37 | + migrations.AlterField( |
| 38 | + model_name='objectrole', |
| 39 | + name='users', |
| 40 | + field=models.ManyToManyField(help_text='Users who have access to the permissions defined by this object role.', related_name='has_roles', through='dab_rbac.RoleUserAssignment', through_fields=('object_role', 'user'), to=settings.AUTH_USER_MODEL), |
| 41 | + ), |
| 42 | + ] |
0 commit comments