-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Orphaned quantities from create_quantity migrate plugin when validation fails #775
Comments
Maybe this is the real issue that should be solved. Our current View of quantities joins in log information, and provides a link to the log so you can get to the entity. If a quantity is not attached to a log, it still appears in the list of quantities, but there is no link to any log that you can use to delete them. It's also possible to create orphaned entities via the API. In fact, it's necessary to create quantity entities before you reference them from a log entity. If anything goes wrong during that process, and the log isn't created, you're left with orphans. One option might be to add the ability to delete quantities directly from Records > Quantities in the main menu. But that's a bit complicated because we also need to clean up the reference on the log (for quantities that are not orphaned). And that doesn't really deal with the fact that someone who imports a CSV file will have no way of knowing that these orphaned quantities created. Nor should they. They shouldn't have to clean them up. |
Two ideas:
Option 2 would work, and would cover ALL cases of orphaned entities. It feels a little risky to be deleting anything via cron, though... but if we are careful with the logic it would probably be OK. |
Also need to consider how this would work with quantity revisions. A log can have multiple revisions to it's So we would need to make sure we don't delete a quantity that's referenced by a previous log revision. |
I discovered a bug while working on a custom CSV importer (following the guide at https://farmos.org/development/module/csv/) using the
create_quantity
plugin provided by thequantity
module in farmOS: https://github.com/farmOS/farmOS/blob/17b792aca77fe757e7f7b18a95f8e5aedae1e192/modules/core/quantity/src/Plugin/migrate/process/CreateQuantity.phpWhen
validate: true
is used in the migration'sdestination
config, and an imported entity's validation fails, the quantity entity is still created, resulting in orphaned quantity entities.I don't think this is really
create_quantity
's fault. The same would be true of entity's created by themigrate_plus
module'sentity_generate
plugin I believe. It's the nature of how those plugins work. It's also possible to end up with orphaned taxonomy terms, for example, if you useentity_generate
to create a term and validation fails. But at least with terms you can go in manually and clean them up in the UI.There is no way to clean up orphaned quantities in farmOS.
The text was updated successfully, but these errors were encountered: