Skip to content

Commit 5621a62

Browse files
committed
refactor: rename CourseAuthoringMigrationRun to AuthzCourseAuthoringMigrationRun
1 parent e6a7106 commit 5621a62

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

openedx_authz/admin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from django import forms
55
from django.contrib import admin
66

7-
from openedx_authz.models import CourseAuthoringMigrationRun, ExtendedCasbinRule
7+
from openedx_authz.models import AuthzCourseAuthoringMigrationRun, ExtendedCasbinRule
88

99

1010
class CasbinRuleForm(forms.ModelForm):
@@ -50,9 +50,9 @@ class CasbinRuleAdmin(admin.ModelAdmin):
5050
inlines = [ExtendedCasbinRuleInline]
5151

5252

53-
@admin.register(CourseAuthoringMigrationRun)
54-
class CourseAuthoringMigrationRunAdmin(admin.ModelAdmin):
55-
"""Admin for CourseAuthoringMigrationRun to display additional metadata."""
53+
@admin.register(AuthzCourseAuthoringMigrationRun)
54+
class AuthzCourseAuthoringMigrationRunAdmin(admin.ModelAdmin):
55+
"""Admin for AuthzCourseAuthoringMigrationRun to display additional metadata."""
5656

5757
list_display = ("id", "scope_type", "scope_key", "migration_type", "status", "created_at", "updated_at")
5858
search_fields = ("scope_type", "scope_key", "migration_type", "status")

openedx_authz/engine/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
batch_unassign_role_from_users,
2222
)
2323
from openedx_authz.constants.roles import LEGACY_COURSE_ROLE_EQUIVALENCES, LIBRARY_ADMIN, LIBRARY_AUTHOR, LIBRARY_USER
24-
from openedx_authz.models.migrations import CourseAuthoringMigrationRun, MigrationType, ScopeType
24+
from openedx_authz.models.migrations import AuthzCourseAuthoringMigrationRun, MigrationType, ScopeType
2525

2626
logger = logging.getLogger(__name__)
2727

@@ -239,7 +239,7 @@ def _run_scoped_migration(
239239
) -> tuple[list, list]:
240240
"""Orchestrate a migration over a set of scopes with per-scope locking and tracking.
241241
242-
For each scope, creates a ``CourseAuthoringMigrationRun``, acquires a distributed lock,
242+
For each scope, creates a ``AuthzCourseAuthoringMigrationRun``, acquires a distributed lock,
243243
and delegates the work to ``process_scope_fn``. Scopes whose lock cannot be acquired are
244244
marked SKIPPED.
245245
@@ -271,7 +271,7 @@ def _run_scoped_migration(
271271
"org_id": org_id if scope_type == ScopeType.ORG else None,
272272
"delete_after": delete_after_migration,
273273
}
274-
migration_run = CourseAuthoringMigrationRun.create_pending(migration_type, scope_type, scope_key, metadata)
274+
migration_run = AuthzCourseAuthoringMigrationRun.create_pending(migration_type, scope_type, scope_key, metadata)
275275

276276
if not _acquire_lock(scope_type, scope_key, migration_run.id):
277277
logger.warning(f"Migration already in progress for {scope_type}:{scope_key}.")

openedx_authz/migrations/0008_courseauthoringmigrationrun.py renamed to openedx_authz/migrations/0008_authzcourseauthoringmigrationrun.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.2.12 on 2026-04-08 21:33
1+
# Generated by Django 5.2.12 on 2026-04-09 22:46
22

33
from django.db import migrations, models
44

@@ -10,7 +10,7 @@ class Migration(migrations.Migration):
1010

1111
operations = [
1212
migrations.CreateModel(
13-
name="CourseAuthoringMigrationRun",
13+
name="AuthzCourseAuthoringMigrationRun",
1414
fields=[
1515
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
1616
(
@@ -73,9 +73,9 @@ class Migration(migrations.Migration):
7373
"verbose_name_plural": "Course Authoring Migration Runs",
7474
"ordering": ["-created_at"],
7575
"indexes": [
76-
models.Index(fields=["scope_type", "scope_key"], name="openedx_aut_scope_t_84caa9_idx"),
77-
models.Index(fields=["status"], name="openedx_aut_status_0323a9_idx"),
78-
models.Index(fields=["-created_at"], name="openedx_aut_created_c36aef_idx"),
76+
models.Index(fields=["scope_type", "scope_key"], name="openedx_aut_scope_t_d43a35_idx"),
77+
models.Index(fields=["status"], name="openedx_aut_status_e34b60_idx"),
78+
models.Index(fields=["-created_at"], name="openedx_aut_created_ab3e0a_idx"),
7979
],
8080
},
8181
),

openedx_authz/models/migrations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ScopeType(models.TextChoices):
3030
ORG = "org", "Organization"
3131

3232

33-
class CourseAuthoringMigrationRun(models.Model):
33+
class AuthzCourseAuthoringMigrationRun(models.Model):
3434
"""Track the status of course authoring migration tasks.
3535
3636
This model is used to track async migrations between the legacy
@@ -94,7 +94,7 @@ class Meta:
9494
]
9595

9696
@classmethod
97-
def create_pending(cls, migration_type, scope_type, scope_key, metadata=None) -> "CourseAuthoringMigrationRun":
97+
def create_pending(cls, migration_type, scope_type, scope_key, metadata=None) -> "AuthzCourseAuthoringMigrationRun":
9898
"""Create a pending migration run."""
9999
return cls.objects.create(
100100
migration_type=migration_type,

0 commit comments

Comments
 (0)