-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Make PurgeOrphanConversations migration safer #5572
Conversation
Don't we want to delete the dependent messages if nobody can see them anymore? |
Maybe, but tbh the most important thing is to minimize problems with pods upgrading. IMHO having a few message objects on a few pods left around is a very minor problem :) |
I'm not sure I can agree when the entire point of the migration is to cleanup data, by that logic I'd rather drop it completely. |
Fair point if we were living in a "all or nothing" world. I do find it hard to accept though that it would be better to leave everything than to try and clean as much as possible. To me: IMHO it's overkill to start optimising this to delete a message in the event of an exception (which exception?). And that would also have to be rescued due to the ddl transaction disable call. And what do we do then to keep things perfect? I'll be happy either way, if this is merged or not, already migrated my pod. Just thought this safeguard might help some pods get to 0.5 :) |
Can't we just pass the |
I'm not familiar enough with the RoR ORM to say whether that is a safe thing to do here. Also, I'm not able to test it, since I've migrated my pod past this. If you think that is a safe thing to set here without testing then sure, please can you either give the line and I can edit or do the change - but personally I don't like committing (data destructive) code I cannot verify myself. Besides, we don't know whether any pods at all will have the kind of data my pod had. Or maybe many do. Leave it up to you :) |
Yeah right, this definitely should be verified. Maybe @margori can help us out here :) |
Count on me. I see that this issue is about Postgre. I've tested only over MySQL. |
First, I wonder why did migration fail. I didn't expect it to fail by foreign key. @jaywink , Is 'messages_conversation_id_fkey' constrain set to cascade deleting? Reading db schema, I found that that key should be named 'messages_conversation_id_fk' not 'messages_conversation_id_fkey'. Do they both constrains exists in your db? In your opinion, how can we handle this kind of db mismatch? |
Well, I remembered I still have the conversation that killed the upgrade, initially somehow thought I didn't have access to it, but of course it is still there. It has two entries in So maybe I will do try the delete all to see if that kills the messages, as Jonne suggested. |
fa7d257
to
a6dee8f
Compare
Meh, I can't try this out on my pod now, but will report later. To test, added a new migration which would obviously in the final pull replace the original. AFAICT the Oh also figured it needs to be |
As I expected, table 'message' in your db is set to cascade deleting. To have a smoother migration and still showing podmin wich conversation must be deleted, I offer this code:
I tested in MySQL and PostgreSQL, with or without cascade deleting. What do you think? |
@jaywink By the way, I believe that last participant in a conversation will receive an error message when deleting conversation in iliketoast.net pod. Can you check that? |
I guess this is not needed, or really have no idea if it is needed. It helped me, but I think on IRC heard that the migrations should be safer now :) |
@jaywink I did not notice so about this one. I think we got the utf8mb4 fairly stable now though. Could you clarify? |
@jhass clarify what? I think you were the one who said the migrations should be more stable so I don't think this needs to be merged in :) I just forgot to close it, just saw it in the 0.5 milestone.. |
Weird, I can't remember saying that about this one. The utf8mb4 one, sure. |
Maybe it was more generic towards "migrations". Anyway, I'm sure we will Regarding 0.5, could we please cut the RC soon? See Loomio discussion :) On 23.03.2015 22:23, Jonne Haß wrote:
Br, |
This migration crashed when I updated iliketoast.net
In order to make 0.5 upgrades for the 100+ pods safer, I'd propose adding some safety by using rescue to catch deletion problems. In my situation, it was one conversation that failed with: