Unable to update/reinstall Polls App

Hi there,

i’ve been unable to update the polls app for the last few month during updates. Every time i update Nextcloud i try to update Polls (or remove/install), but there seems to be an issue with some (or “the”) polls table.

Database error when running migration 030400Date20211125120000 for app polls
An exception occurred while executing a query:
Unique violation: 7
ERROR: duplicate key value violates unique constraint “uniq_votes”
DETAIL: Key (poll_id, user_id, vote_option_text)=(8, xenomat, 2021-08-27T22:00:00+00:00 - 2021-08-28T22:00:00+00:00) already exists.

I’m not sure why the migration process is trying to duplicate an entry, but does anyone have an idea how to fix this? Can’t i just clear or empty the Polls table if i don’t need it? Or maybe fix it, i don’t even remember which polls we had running because i wasn’t able to use the app for at least half a year. I don’t understand why uninstalling the Polls app doesn’t give the option to clear the data.
I mean i can try to delete this one vote, but not sure if there is a bigger underlying problem with some kind of change in the keys/indexes or whatever. Thanks!

Update: Ok it seems to be in the table oc_polls_votes. Maybe i clear all my votes for the affected poll… not sure if this will help or if there just will be another issue or error after that.


Just drop all oc_polls_* tables and reinstall the app. Or remove all duplicates reported manually.

What happens: the migrations tries to add a unique index, but fails due to duplicated entries (an old bug in a prior version).

But interesting at all, since there is a repair step before the migration, which should remove duplicate entries and prevent that error.

1 Like

You can expect better and faster reactions to this kind of errors, when reporting them in the github repo.