Documentation
¶
Overview ¶
Package migrationlint enforces the SQL conventions every migration source must follow, so the OSS set and any downstream set are held to the same contract. Two rule families:
- Schema-agnostic: no schema-qualified identifiers, no CREATE SCHEMA, no SET search_path. The runtime schema is set via the migrator's SchemaName/search_path, so migration SQL must stay unqualified.
- Single-transaction atomicity: no CONCURRENTLY, no explicit transaction control, no other statement Postgres refuses to run inside a transaction block. The migrator applies each file as one implicit transaction; the orchestrator's failure-restore relies on a failed file rolling back its DDL rather than half-applying.
Each migration set runs Check against its own embedded FS from a test:
func TestMigrationsLint(t *testing.T) {
violations, err := migrationlint.Check(myMigrations, "migrations")
if err != nil {
t.Fatal(err)
}
for _, v := range violations {
t.Errorf("%s", v)
}
}
The rules mirror the contract documented in the OSS migrations README.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Violation ¶
type Violation struct {
// File is the path within the linted FS.
File string
// Line is the 1-based line number of the match.
Line int
// Match is the substring that tripped the rule.
Match string
// Message explains why the pattern is rejected.
Message string
}
Violation is a single rejected line in a migration file.
Click to show internal directories.
Click to hide internal directories.