bikeshedder / tusker

PostgreSQL migration management tool
The Unlicense
208 stars 17 forks source link

Support migration filenames pattern #12

Closed daa closed 2 years ago

daa commented 2 years ago

Recently I had a need to support migration tool using slightly different migration structure not supported directly by Tusker: migrations/<dbname>/<timestamp>_name/{up,down}.sql (Hasura migrations). And Tusker happened to be so wonderful tool that I couldn't refuse to use it so I decided to implement a new feature.

Here new optional filename parameter is supported in the migrations section. This parameter defines a glob pattern for migration filenames and is mutually exclusive with directory.

bikeshedder commented 2 years ago

Great idea.

I do wonder if directory should actually be deprecated in favor of filename. I like the idea of glob patterns for the migrations. That would make the schema and migrations configuration identical.

bikeshedder commented 2 years ago

I just released Tusker 0.4.0 which includes these changes.

I also change the README so it uses migrations.filename rather than migrations.directory.

It doesn't hurt to have some backwards compatibility, but I'd prefer to remove the migrations.directory configuration option in the future.

daa commented 2 years ago

Thank you very much! I overlooked that migration filenames are filtered by .sql extension even if they are defined by glob pattern, will fix it later.

bikeshedder commented 2 years ago

Oh right. I missed that when reviewing the PR as well. :see_no_evil:

Using a .sql extension is a sensible choice, but that should not be enforced when using glob patterns. If you create a PR for that I'll merge that and prepare a 0.4.1 release.