[23.0.1RC1, 22.2.4RC1] DB migration issue with user_ldap with postgres
blizzz opened this issue ยท 3 comments
blizzz commented
How to use GitHub
- Please use the ๐ reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Steps to reproduce
- Get latest 22.2.3/23.0.0 and install it
- enable LDAP, configure it with groups, visit users page to ensure the mapping tables are not empty
- switch to beta channel
- upgrade
Expected behaviour
- upgrade procedure runs through smoothly
Actual behaviour
- Exception:
Database error when running migration latest for app user_ldap
- in the log we find:
SQLSTATE[42704]: Undefined object: 7 ERROR: index \"primary\" does not exist"
Background
- The issue lies within https://github.com/nextcloud/server/blob/master/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php#L107-L108
- There is no index called "primary", to resolve this the second line has to provide the existing name of the private key, which is
oc_ldap_group_mapping_pkey
for the table in question. Because when it is not the case, Doctrine will choose to drop"primary"
- It is fruitless nevertheless, because the index cannot be dropped:
SQLSTATE[2BP01]: Dependent objects still exist: 7 ERROR: cannot drop index oc_ldap_group_mapping_pkey because constraint oc_ldap_group_mapping_pkey on table oc_ldap_group_mapping requires it HINT: You can drop constraint oc_ldap_group_mapping_pkey on table oc_ldap_group_mapping instead.
- Removing line 107 does not help, for
n index with name 'oc_ldap_group_mapping_pkey' was already defined on table 'oc_ldap_group_mapping'.
- At the moment Doctrine does not support removing primary key constraints. This may be added, my naive attempts so far were not successful.
- Upstream issue: doctrine/dbal#2925
- Sqlite is not affected, MySQL and Oracle i have not tested.
@skjnldsv imo this is a release blocker
nickvergessen commented
Yeah you can not remove primary keys and can not add autoincrement in hindsight.
So make a new table and copy over the content and in migration 2 delete the old table.
While on it let's try to make the method internal or so, so people see something is wrong with it.
ParleurA commented
Is it an easy way to easily fix the migration manually, before the next RCโฏ?
My instance has been broken for twelve days by this bug, now.