diff --git a/awx/main/migrations/0008_v300_rbac_changes.py b/awx/main/migrations/0008_v300_rbac_changes.py index 896e81558a..dd112700cf 100644 --- a/awx/main/migrations/0008_v300_rbac_changes.py +++ b/awx/main/migrations/0008_v300_rbac_changes.py @@ -129,6 +129,10 @@ class Migration(migrations.Migration): name='ancestors', field=models.ManyToManyField(related_name='descendents', through='main.RoleAncestorEntry', to='main.Role'), ), + migrations.AlterIndexTogether( + name='role', + index_together=set([('content_type', 'object_id')]), + ), migrations.AlterIndexTogether( name='roleancestorentry', index_together=set([('ancestor', 'content_type_id', 'object_id'), ('ancestor', 'content_type_id', 'role_field'), ('ancestor', 'descendent')]), diff --git a/awx/main/models/rbac.py b/awx/main/models/rbac.py index 3ee63c8497..ed3e9272d5 100644 --- a/awx/main/models/rbac.py +++ b/awx/main/models/rbac.py @@ -106,6 +106,9 @@ class Role(models.Model): app_label = 'main' verbose_name_plural = _('roles') db_table = 'main_rbac_roles' + index_together = [ + ("content_type", "object_id") + ] role_field = models.TextField(null=False) singleton_name = models.TextField(null=True, default=None, db_index=True, unique=True)