Documentation
¶
Overview ¶
Package lint analyzes SQL migrations for destructive or risky changes.
It parses each migration's up SQL with internal/parse and walks the resulting statement nodes, emitting Findings for patterns that can lose data, take heavy locks, or otherwise fail on a populated production database. The linter is database-free: it operates purely on the parse tree and never connects to or executes against a server.
Index ¶
Constants ¶
View Source
const ( RuleParseError = "parse-error" RuleDestructiveDrop = "destructive-drop" RuleDestructiveTrunc = "destructive-truncate" RuleColumnTypeChange = "column-type-change" RuleNotNullNoDefault = "not-null-no-default" RuleIndexNotConcurr = "index-not-concurrent" RuleMissingDown = "missing-down" )
Rule identifiers. These are stable strings suitable for allow-listing.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Finding ¶
type Finding struct {
Version string // migration version ("" for cross-file findings)
Rule string // stable rule id, e.g. "destructive-drop"
Severity Severity
Message string
}
Finding is a single lint result tied to a migration version.
type Severity ¶
type Severity string
Severity is the seriousness of a Finding.
const ( // SeverityError marks a change that loses data or is otherwise unsafe; it // should block a migration unless explicitly overridden. SeverityError Severity = "error" // SeverityWarning marks a change that is risky (e.g. takes a lock) but not // inherently destructive. SeverityWarning Severity = "warning" )
Click to show internal directories.
Click to hide internal directories.