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

Migration issue: duplicate entities created #261

Closed
bradfordcondon opened this issue Jan 18, 2018 · 5 comments
Closed

Migration issue: duplicate entities created #261

bradfordcondon opened this issue Jan 18, 2018 · 5 comments
Labels
Community - Discussion Any issue focused on discussion from the community. It does not apply to enhancements. Tripal 3 Any issue or pull requuest focused on Tripal 3

Comments

@bradfordcondon
Copy link
Member

bradfordcondon commented Jan 18, 2018

The problem

It's a fairly edge case. If I migrate a content type, then run Tripal Alchemist to convert that entity to a new type... if I migrate again, i'll create a new entity.

The example is Analysis. Analyses migrate to one type (analysis) and i created Alchemist so i could trnasform analyses to new types (unigene analysis, blast annotation analysis, etc).

You probably won't be running migration too many times, but if you migrated analyses, and then later migrated libraries but accidentaly used "migrate all" you'd run into problems.

To reproduce

  • Create a tripal 2 analysis sub type (ie tripal_blast).
  • Run a migration
  • Run alchemist to convert your entities from Analysis to analysis_blast
  • re-run migration
  • You now have the same entry as an analysis and analysis_blast

To fix

We could look up the Tripal Entity in tripal_entity not in the target bundle location. The problem is that there is no record_id column in TE.

Alternatively, we could also try and fetch that entity because we know the record_id and base table. So chado_get_record_entity_by_table should work.

Is there another solution?

@spficklin spficklin added Tripal 3 Any issue or pull requuest focused on Tripal 3 Community - Discussion Any issue focused on discussion from the community. It does not apply to enhancements. labels Jan 19, 2018
@spficklin
Copy link
Member

This is definitely annoying. However, there's no problems with having two content types that reference the same data. Tripal can deal with it just fine. The quick solution is to just delete the unwanted content type after all migration is completed. It's annoying but is a quick fix. Unless you think this may be a major turn off for folks migrating from Tv2 I'm tempted to put this at the bottom of the TODO list? Thoughts?

@bradfordcondon
Copy link
Member Author

bradfordcondon commented Jan 19, 2018

The quick solution is to just delete the unwanted content type after all migration is completed

This is totally fine.... if you aren't using that content type for anything else. If the content type becomes a mix of stuff you want, and stuff that is duplicated in another type... now that's a headache I'd like to avoid.

It would be OK for hardwoods to consider this low priority.

@spficklin
Copy link
Member

Oh, can you give an example of how this mix might occur?

@bradfordcondon
Copy link
Member Author

  • Migrate analysis content type
  • Convert some to the new entity type
  • re-migrate (this is an accident, maybe i migrate-all when i meant to migrate a specific entity type)
  • Now my analysis entity has a mix of stuff thats duplicated in another entity, as well stuff that i didnt convert that i still want.

Honestly this scenario revolves around accidentally migrating content types a second time, so maybe I'll just put a notice that you should be careful about re-migrating or you will end up with duplicates.

It's happening to me a lot right now because I'm developing and running migrations over and over to test, but in an actual use case, maybe this won't ever come up.

If you don't think its going to happen in production I'll close this out.

@spficklin
Copy link
Member

I'm still not quite following what you mean. What is the "stuff" that's duplicated and what is the stuff you didn't convert that you want? All of the fields should be duplicated, right?

laceysanderson pushed a commit that referenced this issue Dec 7, 2022
Automatic Creation of Single Valued, String Chado Fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community - Discussion Any issue focused on discussion from the community. It does not apply to enhancements. Tripal 3 Any issue or pull requuest focused on Tripal 3
Projects
None yet
Development

No branches or pull requests

2 participants