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

MySQL strict mode maintenance scheduling fix. #8659

Merged
merged 1 commit into from May 8, 2018

Conversation

Projects
None yet
4 participants
@angryp
Contributor

angryp commented May 3, 2018

Fix for recurring date placeholders in maintenance scheduling form. Only actual for MySQL-community, tested on 5.7.20 and 5.7.22.
More information: https://community.librenms.org/t/mysql-and-scheduled-maintenace/3100

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

Fix for recurring date placeholders in maintenance scheduling form. O…
…nly actual for MySQL-community, tested on 5.7.20 and 5.7.22.
@scrutinizer-notifier

This comment has been minimized.

scrutinizer-notifier commented May 3, 2018

The inspection completed: No new issues

@murrant

This comment has been minimized.

Member

murrant commented May 4, 2018

@angryp I haven't looked but isn't the end supposed to be null? Start could also be today by default, but either is fine.

@angryp

This comment has been minimized.

Contributor

angryp commented May 7, 2018

Hello @murrant!

If I set $end_recurring_dt to null in a source code, I will receive the following error with MySQL-community:

2018-05-07 05:49:51 MySQL Error: Incorrect date value: '' for column 'end_recurring_dt' at row 1 (INSERT INTO alert_schedule (recurring,start,end,start_recurring_dt,end_recurring_dt,start_recurring_hr,end_recurring_hr,recurring_day,title,notes) VALUES ('0','2018-05-07 05:49','2018-05-07 06:49','1970-01-02','','00:00:00','00:00:00','','test',''))

Again, this only applies to MySQl-community and only to one-time maintenance.

@laf

laf approved these changes May 7, 2018

LGTM.

I assume you don't have sql_mode set to null for mysql?

@murrant

This comment has been minimized.

Member

murrant commented May 8, 2018

I see that now, didn't expand the code :) Btw, if you are trying to help fix these legacy sql issues great! if you are trying to fix your issues in production, I suggest settting sql_mode='' as mentioned in the docs.

@murrant murrant merged commit 2d23771 into librenms:master May 8, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@murrant murrant changed the title from MySQL-community maintenance scheduling fix. to MySQL strict mode maintenance scheduling fix. May 8, 2018

@murrant murrant added the Bug 🐞 label May 8, 2018

slashdoom added a commit to slashdoom/librenms that referenced this pull request May 8, 2018

Fix for recurring date placeholders in maintenance scheduling form. O…
…nly actual for MySQL-community, tested on 5.7.20 and 5.7.22. (librenms#8659)

slashdoom added a commit to slashdoom/librenms that referenced this pull request May 8, 2018

Fix for recurring date placeholders in maintenance scheduling form. O…
…nly actual for MySQL-community, tested on 5.7.20 and 5.7.22. (librenms#8659)

TheMysteriousX added a commit to TheMysteriousX/librenms that referenced this pull request May 20, 2018

Fix for recurring date placeholders in maintenance scheduling form. O…
…nly actual for MySQL-community, tested on 5.7.20 and 5.7.22. (librenms#8659)

@lock lock bot locked as resolved and limited conversation to collaborators Jul 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.