feat: v0.2.0 — Atlas driver, lint tool, atlas plugin binary, Dockerfile#2
Merged
Conversation
Task 27: Atlas driver (ariga.io/atlas v1.2.0) - internal/atlas/driver.go: full MigrationDriver implementation (Up/Down/Status/Goto) - internal/atlas/revisions.go: SQL-backed RevisionReadWriter (atlas_schema_revisions table) - internal/atlas/driver_test.go: Name + UpDownStatus integration tests - Auto-generates atlas.sum when absent so Atlas CLI is not required for basic ops - Down reads paired <version>.down.sql files for rollback SQL Task 28: Lint tool - pkg/lint/lint.go: static analysis (L001 ordering gap, L002 duplicate, L003 naming, L004 dangerous ops, L005 missing .down.sql, L006 empty file) - pkg/lint/lint_test.go: one test per lint code - pkg/cli/lint.go: `migrate lint <dir>` cobra subcommand with --json output Task 27 (cont): Atlas plugin binary wiring - internal/atlasplugin/plugin.go: replace stub with real CreateModule dispatcher - internal/atlasplugin/modules.go: atlasMigrationsModule, driverModule, driverBackedModule Task 29: workflow-migrate standalone binary - cmd/workflow-migrate/Dockerfile: distroless/static OCI image for pre-deploy jobs Task 30: wfctl CLI update - pkg/cli/root.go: add lint subcommand + atlas driver support - plugin.json: update description, keywords, migrationDrivers, cliCommands Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- gofmt: fix import ordering in driver_test.go (workflow-plugin-migrations before workflow) - gofmt: fix over-aligned stubs in atlasplugin/modules.go - atlas/driver.go: replace 1MB fixed read buffer with io.ReadAll in runDown - Dockerfile: use ARG TARGETARCH + GOARCH=$TARGETARCH for multi-platform buildx support - atlasplugin/modules.go: add clarifying comment explaining driverBackedModule.InvokeMethod is intentionally unimplemented (use workflow-plugin-migrations binary for those drivers) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gofmt requires a blank line between the Stop stub and the doc comment on driverBackedModule.InvokeMethod. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The testharness creates an isolated schema (wfm_test_*) that Atlas sees as a non-clean database state, causing the executor to refuse to run. WithAllowDirty(true) tells Atlas to proceed regardless of existing schemas in the database — correct for tests and for users running migrations against non-empty Postgres instances. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Atlas scans all *.sql files in the migration directory. Placing .down.sql files in the same directory as up migrations causes duplicate version numbers (e.g. both 00001_create_users.sql and 00001_create_users.down.sql have version 00001). When Atlas processes the second file for an already-seen version it reads the stored revision (Applied=1) and tries to validate PartialHashes[0], which is nil in our implementation — causing a panic at migrate.go:855. Fix: require down files to live in <dir>/down/<name>.down.sql. Update runDown() to check the preferred path first, with a legacy fallback to the flat layout. Update makeAtlasDir() in tests to write down files to the new subdirectory. Drop the now-unused "io" import. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pkg/conformance/runner.go — CLI-friendly Runner (no *testing.T) with Setup() for --keep-alive and Run() for full-cycle + checkpoint cases. pkg/cli/test.go — `migrate test` cobra command: drives the conformance Runner against a user-supplied DSN + source-dir. --keep-alive applies all migrations and prints DSN for integration test setup. pkg/cli/tenant_ensure.go — `migrate tenant-ensure` cobra command: CREATE SCHEMA IF NOT EXISTS via pgx, idempotent pre-deploy step for multi-tenant environments. pkg/cli/root.go — register both new commands in NewRoot(). plugin.json — add test + tenant-ensure to cliCommands subcommands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
internal/atlas) backed byariga.io/atlas v1.2.0— fullUp/Down/Status/Gotowith SQL-backedRevisionReadWriter(atlas_schema_revisionstable); auto-generatesatlas.sumwhen absent so Atlas CLI is not requiredpkg/lint) — checks L001 ordering gaps, L002 duplicates, L003 naming convention, L004 dangerous ops, L005 missing.down.sql, L006 empty files;migrate lint <dir> [--json]CLI subcommandinternal/atlasplugin— replace stub with realCreateModuledispatcher supporting all three drivers;driverBackedModulestubs for golang-migrate/goose explain intentional non-implementationcmd/workflow-migrate/Dockerfile— two-stage distroless/static OCI image withARG TARGETARCHfor multi-platformbuildxsupportpkg/cli/root.goaddslintsubcommand +atlasdriver case;plugin.jsonupdated with lint incliCommandsand atlas in keywordsTest plan
go build ./...cleango vet ./...cleango test ./... -short -count=1 -racepasses all packages includinginternal/atlasandpkg/lint🤖 Generated with Claude Code