diff --git a/specifyweb/specify/migrations/0012_fix_accepted_taxon.py b/specifyweb/specify/migrations/0012_fix_accepted_taxon.py new file mode 100644 index 00000000000..d250473d62f --- /dev/null +++ b/specifyweb/specify/migrations/0012_fix_accepted_taxon.py @@ -0,0 +1,22 @@ +# Generated by Django 3.2.15 on 2024-11-01 19:21 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('specify', '0011_cascading_tree_nodes'), + ] + + operations = [ + # Fixes an issue due to a bug in the WorkBench prior to 7.9.0 that did not + # set accepted nodes to IsAccepted = 1 when they were not synonyms. + # https://github.com/specify/specify7/issues/5131 + migrations.RunSQL( + 'UPDATE taxon t1 SET IsAccepted = TRUE WHERE t1.IsAccepted = 0 AND t1.AcceptedId IS NULL', + # This should not need to be reversed, but this allows for rollback without reversing the SQL + reverse_sql='' + ) + ] +