sql-migrate icon indicating copy to clipboard operation
sql-migrate copied to clipboard

recursively process migrations folder

Open opensas opened this issue 5 years ago • 2 comments

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?

opensas avatar Mar 27 '19 08:03 opensas

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.

rubenv avatar Mar 27 '19 08:03 rubenv

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.

opensas avatar Apr 05 '19 05:04 opensas