You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

  1. # Generated by Django 3.2.8 on 2022-01-07 01:58
  2. from django.db import migrations
  3. def recover_label(apps, schema_editor):
  4. CategoryType = apps.get_model('api', 'CategoryType')
  5. SpanType = apps.get_model('api', 'SpanType')
  6. Label = apps.get_model('api', 'Label')
  7. for model in [CategoryType, SpanType]:
  8. for label in model.objects.all():
  9. old_label = Label(
  10. id=label.id,
  11. text=label.text,
  12. prefix_key=label.prefix_key,
  13. suffix_key=label.suffix_key,
  14. project=label.project,
  15. background_color=label.background_color,
  16. text_color=label.text_color,
  17. created_at=label.created_at,
  18. updated_at=label.updated_at
  19. )
  20. old_label.save()
  21. class Migration(migrations.Migration):
  22. dependencies = [
  23. ('api', '0024_auto_20211221_1444'),
  24. ]
  25. operations = [
  26. migrations.RunPython(
  27. code=migrations.RunPython.noop,
  28. reverse_code=recover_label
  29. )
  30. ]