Source code for tcms.testcases.migrations.0014_update_issutracker_types
from django.db import migrations
[docs]
def forwards(apps, schema_editor):
bug_system_model = apps.get_model("testcases", "BugSystem")
for record in bug_system_model.objects.all():
if record.tracker_type:
record.tracker_type = f"tcms.issuetracker.types.{record.tracker_type}"
record.save()
[docs]
def backwards(apps, schema_editor):
bug_system_model = apps.get_model("testcases", "BugSystem")
for record in bug_system_model.objects.all():
if record.tracker_type.startswith("tcms.issuetracker.types."):
record.tracker_type = record.tracker_type.replace(
"tcms.issuetracker.types.", ""
)
record.save()
[docs]
class Migration(migrations.Migration):
dependencies = [
("testcases", "0013_remove_autofield"),
]
operations = [
migrations.RunPython(forwards, backwards),
]