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

We are not properly deleting things #164

Closed
mikfire opened this issue Feb 3, 2016 · 2 comments
Closed

We are not properly deleting things #164

mikfire opened this issue Feb 3, 2016 · 2 comments

Comments

@mikfire
Copy link
Contributor

mikfire commented Feb 3, 2016

Based on the pgsql work, I am really looking at a lot of the database interactions. I noticed today that all of the removeFromRecipe methods simply delete the link in the *_in_recipe table. We make a copy of every ingredient when it gets added to a recipe, this leaves a lot of orphaned copies.

With some google and stack exchange, I was able to craft this query:

select h.id,h.name,h.deleted from hop h left outer join hop_in_recipe hir on ( h.id = hir.hop_id) where hir.id is null and h.display=false;

If I understand this correctly, it says find every row in the hop table that does not have a corresponding row in the hop_in_recipe table. I get about 70 or so responses. I get similar counts for fermentables and fewer for the other tables.

We need to be marking the copies as deleted, at least. I actually think we need to really delete them, since the copy cannot be accessed once it's removed from a recipe. We also probably should write something that will clean all of this up as part of an upgrade process.

@ddk1965
Copy link

ddk1965 commented Feb 3, 2016

Very good idea!

@mikfire
Copy link
Contributor Author

mikfire commented May 25, 2016

This gets fixed with the postgreSQL work, mostly. Still need to do the clean up work, but that can happen after this is released.

@mikfire mikfire closed this as completed May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants