diff --git a/edx_exams/apps/core/migrations/0027_coursestaffrole_unique_course_staff_role.py b/edx_exams/apps/core/migrations/0027_coursestaffrole_unique_course_staff_role.py new file mode 100644 index 00000000..395ec327 --- /dev/null +++ b/edx_exams/apps/core/migrations/0027_coursestaffrole_unique_course_staff_role.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.14 on 2024-07-24 14:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0026_studentallowance'), + ] + + operations = [ + migrations.AddConstraint( + model_name='coursestaffrole', + constraint=models.UniqueConstraint(fields=('user', 'course_id', 'role'), name='unique_course_staff_role'), + ), + ] diff --git a/edx_exams/apps/core/models.py b/edx_exams/apps/core/models.py index 52456fc5..dd8d805d 100644 --- a/edx_exams/apps/core/models.py +++ b/edx_exams/apps/core/models.py @@ -73,6 +73,11 @@ class Meta: db_table = 'exams_coursestaffrole' verbose_name = 'course staff role' + constraints = [ + models.UniqueConstraint(fields=['user', 'course_id', 'role'], + name='unique_course_staff_role') + ] + class ProctoringProvider(TimeStampedModel): """