Uh oh!
There was an error while loading. Please reload this page.
Fix primary key change in user_ldap migration - #30568
Conversation
Uh oh!
There was an error while loading. Please reload this page.
5d42916 to
e2fc013CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| $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
9d11d71Comparecome-nc
commented
Jan 13, 2022
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. |
nickvergessen
commented
Jan 13, 2022
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
skjnldsv
commented
Jan 13, 2022
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
7e4e919Comparecome-nc
commented
Jan 13, 2022
Rebased and removed the autoloader update, can someone which understand this stuff do the autoloader update? |
Signed-off-by: Joas Schilling <coding@schilljs.com>
nickvergessen
commented
Jan 13, 2022
bash build/autoloaderchecker.sh
git add apps/user_ldap/composer/composer/autoload_*
git commit
git restore apps/Done |
come-nc
commented
Jan 13, 2022
/backport to stable23 |
come-nc
commented
Jan 13, 2022
/backport to stable22 |
come-nc
commented
Jan 13, 2022
/backport to stable21 |
come-nc
commented
Jan 13, 2022
/backport to stable20 |
come-nc
commented
Jan 13, 2022
Drone failure is unrelated |
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
blizzz
commented
Jan 13, 2022
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