Add has_timestamp linter#682
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new has_timestamp linter intended to detect MySQL TIMESTAMP columns (Y2038 risk) and report violations during schema linting and migration linting.
Changes:
- Introduces
HasTimestampLinterthat flagsTIMESTAMPusage inCREATE TABLEandALTER TABLEstatements with error/warning severities. - Adds a comprehensive test suite covering
CREATE TABLE,ALTER TABLE, registration, and edge cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/lint/lint_has_timestamp.go | Implements the has_timestamp linter logic for CREATE/ALTER analysis and violation generation. |
| pkg/lint/lint_has_timestamp_test.go | Adds unit tests validating detection, severity, and metadata/registration behaviors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix severity for existing tables: existingTables now produce Warning
(not Error) to avoid blocking all changes to legacy schemas with
TIMESTAMP columns ('don't boil the ocean')
- Fix severity for CREATE TABLE: only CREATE TABLE in changes (new
tables) produce Error; existing table schemas produce Warning
- Exclude columns being fixed from ALTER warnings: DROP COLUMN,
MODIFY to non-TIMESTAMP, and CHANGE to non-TIMESTAMP no longer
produce false-positive warnings when the ALTER is actively fixing
the TIMESTAMP problem
- Add new tests for fix scenarios: ALTER DROP TIMESTAMP column,
ALTER MODIFY TIMESTAMP to DATETIME, ALTER CHANGE TIMESTAMP to
DATETIME, ALTER DROP all TIMESTAMP columns
- Update existing tests to match corrected severity expectations
aparajon
approved these changes
Apr 6, 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.
Fixes #668