Skip to content

Recursive Migration Directory Support (for sqlc compatibility) #951

@Dev-cmyser

Description

@Dev-cmyser

Hello!
Currently, Goose only supports a flat migration directory. However, tools like sqlc allow (and encourage) organizing migrations and schemas in subfolders (e.g., migrations/schema1/, migrations/schema2/). This is very useful for large projects with multiple schemas or logical separation of migrations.

Please add an option (or default behavior) to allow Goose to recursively search for migration files in all subdirectories of the specified GOOSE_MIGRATION_DIR (or -dir). This would make Goose compatible with sqlc and other tools that support/require such structure.

Example folder structure
migrations/
schema1/
001_init.sql
002_add_table.sql
schema2/
001_init.sql
002_add_table.sql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions