Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Update ConvertType.php to read correct DB params #46908

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lwenderoth
Copy link

Summary

Read connection defaults for $type instead of values for the current DB.
My first PR ever, tried my best to do it right..

@szaimen szaimen added this to the Nextcloud 30 milestone Jul 31, 2024
@szaimen szaimen requested review from joshtrichards, a team, ArtificialOwl, icewind1991 and yemkareems and removed request for a team July 31, 2024 14:13
So embarrasing, sorry.. Creating new account, trying to get everything right - and commiting the wrong file.. Sorry!
This is the correction.

Signed-off-by: lwenderoth <l.wenderoth@gmx.de>
@solracsf solracsf changed the title Fix: Update ConvertType.php to read correct DB params, fix #45257 Fix: Update ConvertType.php to read correct DB params Aug 1, 2024
@blizzz blizzz mentioned this pull request Aug 1, 2024
@kesselb
Copy link
Contributor

kesselb commented Aug 1, 2024

Changing createConnectionParams to createDefaultConnectionParams is not enough.

I assume the actual problem will be solved by #46931.

This was referenced Aug 5, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 13, 2024
@skjnldsv skjnldsv modified the milestones: Nextcloud 30, Nextcloud 31 Aug 14, 2024
Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@susnux
Copy link
Contributor

susnux commented Sep 14, 2024

Changing createConnectionParams to createDefaultConnectionParams is not enough.

@kesselb but this is for the to database so we do not have any settings other than the defaults, no?

@kesselb
Copy link
Contributor

kesselb commented Sep 15, 2024

but this is for the to database so we do not have any settings other than the defaults, no?

//additional driver options, eg. for mysql ssl
$driverOptions = $this->config->getValue($configPrefix . 'dbdriveroptions', $this->config->getValue('dbdriveroptions', null));
if ($driverOptions) {
$connectionParams['driverOptions'] = $driverOptions;
}
// set default table creation options
$connectionParams['defaultTableOptions'] = [
'collate' => 'utf8_bin',
'tablePrefix' => $connectionParams['tablePrefix']
];
if ($this->config->getValue('mysql.utf8mb4', false)) {
$connectionParams['defaultTableOptions'] = [
'collate' => 'utf8mb4_bin',
'charset' => 'utf8mb4',
'tablePrefix' => $connectionParams['tablePrefix']
];
}

dbdriveroptions and defaultTableOptions should be applied for the to database as well.
Without, the tables might be created with the wrong charset/collation or the connection is not possible (e.g. missing ssl)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: occ db:convert-type broken since PrimaryReadReplicaConnection support added
5 participants