Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new native lint rule to detect column renames in ALTER TABLE statements, aligning with the broader move toward parser-based linting described in issue #446.
Changes:
- Add
rename_columnlinter to warn onRENAME COLUMNandCHANGE COLUMN old new ...rename patterns. - Add unit tests covering rename and non-rename ALTER variants.
- Refactor violation sorting/printing helpers into
violation.go(and remove the oldcmd_common.go), plus ignorebin/in.gitignore.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/lint/lint_rename_column.go | Implements the new rename_column linter using TiDB AST specs. |
| pkg/lint/lint_rename_column_test.go | Adds test coverage for rename detection across ALTER variants. |
| pkg/lint/violation.go | Centralizes violation sorting/printing helpers used by CLI output. |
| pkg/lint/cmd_common.go | Removed after moving shared helper functions into violation.go. |
| .gitignore | Ignores bin/ output directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aparajon
reviewed
Feb 25, 2026
| Column: strPtr(oldName), | ||
| }, | ||
| Message: fmt.Sprintf("Column rename detected in table %q: %q to %q. Renaming a column cannot be done atomically across application pods, and ORMs that generate column names at compile time (e.g. jOOQ) will break until code is recompiled", change.Table, oldName, newName), | ||
| Severity: SeverityWarning, |
Collaborator
There was a problem hiding this comment.
Should this be a higher severity?
Collaborator
Author
There was a problem hiding this comment.
For now most things are warnings. We will have to revisit all the severity levels though. I'd like to have a 1 pager which explains them and why.
aparajon
approved these changes
Feb 25, 2026
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.
A Pull Request should be associated with an Issue.
Part of #446
Example output: