Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tree structure issues due to an old WorkBench bug #5366

Draft
wants to merge 5 commits into
base: production
Choose a base branch
from

Conversation

grantfitzsimmons
Copy link
Member

@grantfitzsimmons grantfitzsimmons commented Nov 1, 2024

Fixes #5131

⚠️ Note: This PR affects database migrations. See migration testing instructions.

This came up again from a user that was self-hosted so I thought this could be a more meaningful fix.

This 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.

This was done on all hosted databases, but self-hosted users are still potentially facing bad tree structure errors due to this.

The migration is also fully reversible.

specify@c82512644edc:/opt/specify7$ ve/bin/python manage.py migrate specify 0010_updateDelete_parentcojo
Operations to perform:
  Target specific migration: 0010_updateDelete_parentcojo, from specify
Running migrations:
  Rendering model states... DONE
  Unapplying specify.0011_fix_accepted_taxon... OK

Testing instructions

I made this hard since I fixed all cases on hosted databases and on the test panel... but the scope of this is pretty small. These testing instructions are overkill.

Essentially, this is running the following SQL statement:
UPDATE taxon t1 SET IsAccepted = TRUE WHERE t1.IsAccepted = 0 AND t1.AcceptedId IS NULL

Before running the migration:

  1. On production, manually modify taxon records (via SQL) to set IsAccepted to 0 (false) in cases where that record is not a synonym
  2. Try to create a child under that node in Specify (should get a "bad tree structure" error)

After running the migration:

  1. After starting the container on issue-5131, try to create a child under that node in Specify (should no longer see a "bad tree structure" error
  2. Check that the modified taxon record now is shown as accepted (IsAccepted = 1 (true)) in all cases where it is not a synonym.
  3. Check that all taxon records that are synonyms are not now accepted.

@grantfitzsimmons grantfitzsimmons added the Migration Prs that contain migration label Nov 1, 2024
@grantfitzsimmons grantfitzsimmons added this to the 7.9.x milestone Nov 1, 2024
class Migration(migrations.Migration):

dependencies = [
('specify', '0010_updateDelete_parentcojo'),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Update this and the migration number to the appropriate iteration based on the current production branch at the time of merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Migration Prs that contain migration
Projects
Status: 📋Back Log
Development

Successfully merging this pull request may close these issues.

Create a migration to fix tree structure issues due to an old WorkBench bug
3 participants