Skip to content

Move extra params definition to backup manager config #119

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

Merged
merged 3 commits into from
Oct 6, 2019
Merged

Move extra params definition to backup manager config #119

merged 3 commits into from
Oct 6, 2019

Conversation

nafiesl
Copy link
Contributor

@nafiesl nafiesl commented Oct 5, 2019

This PR will be a fix for reported error after laravel 6 support. #118 (comment)

BackupManager\ShellProcessing\ShellProcessFailed
mysqldump: [ERROR] unknown variable 'column-statistics=0'

This fix works for laravel 6 on MySQL 5.7 or MariaDB 10.2.

Kindly please review this @ShawnMcCool, @mitchellvanw.

@robbielove
Copy link
Contributor

This will break functionality for those who require this argument, the PR needs to allow arguments to be passed from a config file instead of hardcoded '' or 'column-statistics=0'

@nafiesl
Copy link
Contributor Author

nafiesl commented Oct 5, 2019

Noted @robbielove, I will try to make it optional via the config file.

@robbielove
Copy link
Contributor

If it helps, I believe the parent package seems to handle this with the ability to pass these parameters, you might find this useful: backup-manager/backup-manager#138

@nafiesl
Copy link
Contributor Author

nafiesl commented Oct 5, 2019

@robbielove, I moved the extraParams to the backup-manager config file.

About your references here, backup-manager/backup-manager#138, I have tried to change the extraParams key and value on this config file:

vendor/backup-manager/backup-manager/config/database.php

But I don't see the change was affected in Laravel project.

So as far as I try, only the backup-manager config file that can be read by Laravel.

@nafiesl nafiesl changed the title Remove -column-statistics=0 extra params Move extra params definition to backup manager config Oct 5, 2019
Copy link
Contributor

@robbielove robbielove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed these changes and realised that this is better suited to an environment variable as the requirement to fill extraParams is based on whether mysql needs --column-statistics=0 or not (e.g. this is required for maria db and maybe mysql 8?) therefore this will be based purely on the enviroment where the app is running.

I propose that you change src/GetDatabaseConfig.php to:
Line 41 'extraParams' => env('DB_PARAMS'),
and remove your changes to config/backup-manager.php

Sorry for suggesting this needs to go in a config file earlier. I have tested your code and also my changes and found both work.

I would also suggest making a note of this in the README.md to suggest that DB_PARAMS="--column-statistics=0" can be added to the .env file for environments that require it. (remembering this can be used for other parameters that I have not explored; like '--max-allowed-packet')

@nafiesl
Copy link
Contributor Author

nafiesl commented Oct 5, 2019

@robbielove, I do agree to have this on env variable, since our env on local, staging and production might be different. But we still need to have it in config. Because, if we use php artisan config:cache all of the direct env var calls like: env('xxxxx') will become null.

Docs reference: https://laravel.com/docs/6.x/configuration#configuration-caching

Wdyt @robbielove?

@robbielove
Copy link
Contributor

I agree with that

@nafiesl
Copy link
Contributor Author

nafiesl commented Oct 5, 2019

Thanks a lot for your review @robbielove, we will wait for repo maintainer's review to see if it fit their need.

@ShawnMcCool ShawnMcCool merged commit c78f0d4 into backup-manager:master Oct 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants