Fix primary key change in user_ldap migration#30568
Conversation
5d42916 to
e2fc013
Compare
| $changeSchema = true; | ||
| } | ||
|
|
||
| if ($table->getPrimaryKeyColumns() !== ['owncloud_name']) { |
There was a problem hiding this comment.
Mind to comment which case there could be? From this file it's either none (then it's created) or 'owncloud_name'
There was a problem hiding this comment.
In 23 primary key for ldap_group_mapping was ldap_dn, which is the reason for all this.
It was changed in https://github.com/nextcloud/server/pull/29523/files#diff-305e20bed2077c1acd13cbf1051427e1179e19d0bfa3054635a99a83827e01a3R89-R95
e7f9d75 to
9d11d71
Compare
|
Ok, I tested the migration and had to refactor a bit, as enlarging the ldap_dn column on ldap_group_mapping was failing because it was a primary key. So now it always goes through the double copy/drop to get the ldap_group_mapping table in the right shape. It worked for my test but I only tested mysql. |
Maybe you can revert the autoloading paart and then only commit the modified files in apps/user_ldap? |
nickvergessen
left a comment
There was a problem hiding this comment.
LGTM apart from the psalm/composer change
|
Please rebase so we can merge :) |
Use a backup table to copy the data, drop table and recreate it with correct primary key, then copy the data back and drop the backup table. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
It is not possible to drop and create the same table in one migration Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com> Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
f567734 to
7e4e919
Compare
|
Rebased and removed the autoloader update, can someone which understand this stuff do the autoloader update? |
Signed-off-by: Joas Schilling <coding@schilljs.com>
bash build/autoloaderchecker.sh
git add apps/user_ldap/composer/composer/autoload_*
git commit
git restore apps/Done |
|
/backport to stable23 |
|
/backport to stable22 |
|
/backport to stable21 |
|
/backport to stable20 |
|
Drone failure is unrelated |
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
|
With the latest commit, migration run through like a hot knife through butter! 🏅 @come-nc |
Use a backup table to copy the data, drop table and recreate it with
correct primary key, then copy the data back and drop the backup table.
Fix #30539
Signed-off-by: Côme Chilliet come.chilliet@nextcloud.com