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.

49 lines
1.4 KiB

2 years ago
2 years ago
  1. # Generated by Django 3.2.11 on 2022-02-04 05:51
  2. from django.db import migrations
  3. class Migration(migrations.Migration):
  4. dependencies = [
  5. ("projects", "0002_auto_20220204_0201"),
  6. ]
  7. operations = [
  8. migrations.RunSQL(
  9. sql="""
  10. UPDATE
  11. projects_project
  12. SET
  13. polymorphic_ctype_id = (
  14. SELECT
  15. t2.id
  16. from
  17. django_content_type t1
  18. INNER JOIN django_content_type t2 ON t1.model = t2.model
  19. WHERE
  20. t1.app_label = 'api'
  21. AND t2.app_label = 'projects'
  22. AND t1.model LIKE '%project'
  23. AND t1.id = projects_project.polymorphic_ctype_id
  24. );
  25. """,
  26. reverse_sql="""
  27. UPDATE
  28. projects_project
  29. SET
  30. polymorphic_ctype_id = (
  31. SELECT
  32. t1.id
  33. from
  34. django_content_type t1
  35. INNER JOIN django_content_type t2 ON t1.model = t2.model
  36. WHERE
  37. t1.app_label = 'api'
  38. AND t2.app_label = 'projects'
  39. AND t1.model LIKE '%project'
  40. AND t2.id = projects_project.polymorphic_ctype_id
  41. );
  42. """,
  43. )
  44. ]