Fix component foreign key migrations for bigint IDs - #416
Merged
Conversation
The component_checks and component_status_changes migrations hardcoded component_id as an unsigned integer, but components.id is a big integer on databases created by early 3.x builds. MySQL and MariaDB refuse a foreign key whose column type differs from the referenced column, so migrating those installations failed with errno 150. Both migrations now read the actual type of components.id and create component_id to match. Fixes cachethq/cachet#4625 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Poo3yQZ5oUvb7R7mzKjpXf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
component_idto the existingcomponents.idcolumn type in the component checks and status changes migrationsWhy
Early Cachet 3 installations may use bigint component IDs, while these migrations previously created unsigned integer foreign keys. MySQL and MariaDB reject that mismatch with errno 150.
Fixes cachethq/cachet#4625
Validation
git show --check 3e1c46d