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

#2885 Fix MySQL8.4 nonstandard foreign keys deprecation #2946

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

Conversation

mcsken
Copy link

@mcsken mcsken commented Dec 19, 2024

Important

I have no previous MySQL experience. This is working queries I generated with the help of AI, and tested locally that it works for my setup using the latest latest MySQL (version 8.4.3) while setting up the Director module on Icinga Web 2 for the first time. Someone with more experience in MySQL should review it, and ideally merge a fix ASAP because it leads to a broken setup for new users (and whoever upgrades MySQL to 8.4+) with a essentially useless SQL error message for a user, which I found no reference to when searching the documentation or online.

The main error the user would normally see looks something like:

Migration 0 failed (SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 'director_generated_config_activity' 'director_generated_config_activity' in the referenced table 'director_activity_log'...

director-error-messages

If you try to set up icinga director with the latest minor version of MySQL 8.4+, the schema creation will fail with confusing SQL error messages. This commit aims to fix that. https://dev.mysql.com/doc/refman/8.4/en/mysql-nutshell.html#mysql-nutshell-deprecations
Copy link

cla-bot bot commented Dec 19, 2024

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @mcsken

  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Please contact us if you think this is the case.

  • If you signed the CLA as a corporation, your GitHub username may not have been submitted to us. Please reach out to the responsible person in your organization.

@mcsken
Copy link
Author

mcsken commented Dec 19, 2024

Not happy I had to sign something for an open source PR, but I signed it....

@bobapple
Copy link
Member

@cla-bot check

@cla-bot cla-bot bot added the cla/signed label Dec 20, 2024
@mcsken
Copy link
Author

mcsken commented Dec 20, 2024

I looked into this a bit more and tried to clean up the AI code:

  • Removed what I believe are duplicate/unnecessary indexes from the original commit.
  • Sticked to the projects original naming and formatting conventions.

Someone ofc should still review it properly, and potentially even test it because I only tested the original commit on my machine.

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.

2 participants