Polls Update to new version fails

the upgrade to the latest poll app version does fail.

Here the log from the german web upgrade:

Update vorbereiten
Log-Level auf “debug” gesetzt
Wartungsmodus eingeschaltet
Reparaturschritt: Repair MySQL collation
Reparaturinformation: Not a mysql database -> nothing to do
Reparaturschritt: Repair SQLite autoincrement
Reparaturschritt: Copy data from accounts table when migrating from ownCloud
Reparaturschritt: Drop account terms table when migrating from ownCloud
Das Datenbankschema wird aktualisiert
Datenbank aktualisiert
Reparaturschritt: Delete duplicates
Doctrine\DBAL\Exception\NotNullConstraintViolationException: An exception occurred while executing ‘ALTER TABLE oc_polls_share ALTER user_id SET NOT NULL’: SQLSTATE[23502]: Not null violation: 7 ERROR: column “user_id” contains null values

looking into the database I found three entries in the tabel oc_polls_share that had no user_id. I manually added some dummy information and could sucessfully finished the update.

interesting side effect, deleting as admin a user with his data from the nextcloud instance does not remove the users information from the polls tables …
Not really GDPR compliant. :frowning:

In my case it was “Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing ‘CREATE UNIQUE INDEX UNIQ_shares ON oc_polls_share (poll_id, user_id)’: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry … for key ‘UNIQ_shares’”

I had to remove the duplicate key from the table.

The migration should have removed the duplicate in the repairstep. Do you remember the field entries and which column causes the exception?

Thanks for your answer!

I have exported the entries in SQL format before deleting them. (from 2 Nextclouds)

Here I the combination of “4” and “3b” was the problem. I deleted the dataset with “user”.

INSERT INTO oc_polls_share (id, token, type, poll_id, user_id, invitation_sent, display_name, email_address) VALUES
(1, ‘Wa52yqTI1nKwiuta’, ‘group’, 4, ‘3b’, 1, ‘’, ‘’),
(2, ‘K5vR9nXipMLNEu3n’, ‘user’, 4, ‘3b’, 2, ‘’, ‘’);

The following set ist only the deleted one. (please note: I replaced the original username, because of privacy).
The problem was in the logs with the combination “3” and "Anonymoususr ". The space after the username was like that in the database.

INSERT INTO oc_polls_share (id, token, type, poll_id, user_id, invitation_sent, display_name, email_address) VALUES
(41, ‘6sBtXPZTItetDqq1’, ‘external’, 3, 'Anonymoususr ', 41, ‘’, ‘’);

This is indeed a bug in polls. The unique index does only contain username and pollId, but not the type. I didn’t think about the situation, that groups and usernames can be identically.
I will have to expand the index and the repair step.

Thanks for the information.

What was the problem here? The same error? Spaces in the username are strange, they should be avoided, but I will check that.

Sorry, but this is a horrible solution. If you don’t know how to manipulate SQL, it’s just gibberish. No harm meant!

For all of you who feel the same way I do:

sudo -u www-data php occ app:disable polls
sudo -u www-data php occ maintenance:mode --off