Skip to content
New issue

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

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

Already on GitHub? # to your account

[mysql] collect foreign key delete and update rule #19797

Merged
merged 5 commits into from
Mar 11, 2025

Conversation

lu-zhengda
Copy link
Contributor

@lu-zhengda lu-zhengda commented Mar 10, 2025

What does this PR do?

This PR enhances MySQL foreign key metadata collection by including delete and update rules from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS. These rules define the referential behavior enforced when a referenced row is deleted or updated. Capturing this information is essential for understanding the impact of foreign key constraints on cascading operations. The possible values for delete and update actions are: CASCADE, SET NULL, SET DEFAULT, RESTRICT, NO ACTION.

Note: On MariaDB 10.5 or above, the REFERENCES privilege at the table scope is required to view delete_rule and update_rule from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.

Motivation

https://datadoghq.atlassian.net/browse/DBMON-5083
The delete and update rules dictate how changes propagate when modifications occurs for a foreign key. Without this information, users reviewing foreign key definitions lack critical context on cascading behaviors. This PR ensures that these actions are captured.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@lu-zhengda lu-zhengda added the qa/skip-qa Automatically skip this PR for the next QA label Mar 10, 2025
Copy link

codecov bot commented Mar 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.22%. Comparing base (8ace7d5) to head (53f6038).
Report is 6 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
cassandra ?
hive ?
hivemq ?
ignite ?
jboss_wildfly ?
kafka ?
mysql 89.49% <100.00%> (?)
presto ?
solr ?

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lu-zhengda lu-zhengda added this pull request to the merge queue Mar 11, 2025
Merged via the queue into master with commit 1c638d8 Mar 11, 2025
51 of 52 checks passed
@lu-zhengda lu-zhengda deleted the zhengda.lu/fk-mysql branch March 11, 2025 15:05
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants