rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.24k stars 280 forks source link

recursively process migrations folder #137

Open opensas opened 5 years ago

opensas commented 5 years ago

Is it possible to process migrations folder and subfolders?

The idea is to better organize my migration, for example, for each release I could create a folder and then inside that folder every sql file of that release. The files could be proccessed in order according to its name, ignoring the folder, to keep it simple.

Is it already supported by sql-migrate? (I did a quick test but it just ignores files in subfolders)

are willing to accept a PR for such a feature?

rubenv commented 5 years ago

It's come up before and I'm not a fan.

But that shouldn't matter: MigrationSource is an interface, so you can just implement your own version in your own application.

It just won't work with the command-line utility, but honestly: don't use that one, embed sql-migrate as a library, run migrations when starting.

opensas commented 5 years ago

Thanks a lot for your reply. My scenario is a bit strange, I don't even have a go application, that's why I'm using the command line utility. I have several lehacy projects (net framework, classic asp, even some visual basic) working with sql server databases and I want to adopt a simple and flexible migration solution schema. I really like your approach and even though I have null experience with go I had a look at the code and it seems like I could fix a thing or two, but perhaps you can point me to some other alternative more command-line orientes. Anyway, I hope you consider adding this feature, otherwise I'll see if I can handle it. Thanks for your work.