discourse/plugins/poll/db/migrate
Natalie Tay fcaefc9f2f
FIX: De-duplicate poll vote on user merge (#22107)
When merging users, polls may error out if the source and target users have both voted on the same poll before. 😢 

There is no constraint on the `poll_votes` table either to support this. Ideally a composite primary key can be used `(poll_id, user_id)`, but alas there is no support yet, which is probably why it wasn't created in the first place.

This fix ensures that merging is successful by only keeping the target poll votes if duplicates exist.

This fix also runs a migration on older poll votes where failed merges would have caused a single user to have voted twice on a single poll. e.g. this weird edge case
2023-06-15 11:18:51 +08:00
..
20150501152228_rename_total_votes_to_voters.rb DEV: Apply syntax_tree formatting to plugins/* 2023-01-07 11:11:37 +00:00
20151016163051_merge_polls_votes.rb DEV: Apply syntax_tree formatting to plugins/* 2023-01-07 11:11:37 +00:00
20160321164925_close_polls_in_closed_topics.rb DEV: Apply syntax_tree formatting to plugins/* 2023-01-07 11:11:37 +00:00
20180820073549_create_polls_tables.rb DEV: Apply syntax_tree formatting to plugins/* 2023-01-07 11:11:37 +00:00
20180820080623_migrate_polls_data.rb DEV: Apply syntax_tree formatting to plugins/* 2023-01-07 11:11:37 +00:00
20191114160613_add_graph_to_polls.rb
20191206123012_add_group_name_to_polls.rb FEATURE: Add 'groups' option to polls (#8469) 2020-01-28 14:30:04 +02:00
20200804144550_add_title_to_polls.rb FEATURE: Add the title attribute to polls (#10759) 2020-10-02 09:21:24 +02:00
20230614041219_delete_duplicate_poll_votes.rb FIX: De-duplicate poll vote on user merge (#22107) 2023-06-15 11:18:51 +08:00