Skip to content

feat: support drizzle v1 folder migrations#5027

Open
avallete wants to merge 12 commits intodevelopfrom
feat/drizzle-folder-migrations
Open

feat: support drizzle v1 folder migrations#5027
avallete wants to merge 12 commits intodevelopfrom
feat/drizzle-folder-migrations

Conversation

@avallete
Copy link
Copy Markdown
Member

@avallete avallete commented Apr 2, 2026

What kind of change does this PR introduce?

Bug fix, feature, docs update, ...

What is the current behavior?

Please link any relevant issues here.

What is the new behavior?

Feel free to include screenshots if it includes visual changes.

Additional context

Add any other context or screenshots.

avallete and others added 11 commits March 20, 2026 19:33
…wMigrationFromFile

Add foundational helpers for Drizzle v1 folder-based migration support:
- ParseVersion: extracts version/name from flat files or folder-based paths
- MigrationName: returns human-readable display name for migration paths
- migrateDirPattern: regex for matching directory names
- NewMigrationFromFile: now uses ParseVersion for both flat and folder paths
Replace the unconditional `continue` on directories with logic that checks
if the directory name matches the migration timestamp pattern and contains
a `migration.sql` file (Drizzle v1 folder format).
…ions and ApplyMigrations

Replace direct migrateFilePattern regex call with ParseVersion to handle
both flat-file and folder-based migration paths; use MigrationName for
display output. Removes path/filepath import no longer needed.
…grations

filepath.Base would return just "migration.sql" for folder-based migrations,
losing the version identity in debug output.
Show version number in error instead of only the flat-file glob pattern.
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 3, 2026

Coverage Report for CI Build 24126424009

Coverage decreased (-0.02%) to 63.795%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: 6 uncovered changes across 2 files (17 of 23 lines covered, 73.91%).
  • 5 coverage regressions across 1 file.

Uncovered Changes

File Changed Covered %
internal/migration/squash/squash.go 6 2 33.33%
internal/migration/repair/repair.go 15 13 86.67%

Coverage Regressions

5 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
internal/utils/git.go 5 57.14%

Coverage Stats

Coverage Status
Relevant Lines: 15346
Covered Lines: 9790
Line Coverage: 63.8%
Coverage Strength: 6.89 hits per line

💛 - Coveralls

@avallete avallete marked this pull request as ready for review April 8, 2026 11:29
@avallete avallete requested a review from a team as a code owner April 8, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants