-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarification: Does goose no longer pick up migration files from subdirectories? #349
Comments
I think I know what the issue is, but to confirm, do these subdirectories contain different timestamped migration files, and you're expecting goose to collect all the migrations in those subdirectories? For this example, running
Note, I'm using |
@mfridman This is exactly how my directory structure looks like. All I need is a simple syntax that picks up a flat list of all migrations in all subfolders, ordered by the timestamp. Unfortunately if I execute the following call:
I get
If I add quotation marks around the
|
Thanks for clarifying, this functionality hasn't exited in ~5 years. The command I pasted above worked because I removed the Lines 145 to 147 in b44efc3
Need to add the quotes so the shell doesn't expand the path, and with latest goose the error is expected:
I'm vague on the details, but this was probably added with the intention that all migration files be placed within a single directory. However, given how popular Would it be feasible to place all migration files in a single directory, and then point the individual Lastly, I presume you're doing it this way because of, arguably, a limitation in sqlc? |
I've been going back and forth on this one. This only really makes sense for timestamped migrations, because splitting sequential migrations across subdirectories will make reasoning about migrations quite difficult. The way I'd imagine this working is a separate flag The default, however, is to scan a single directory. cc @VojtechVitek maybe you have some thoughts, but I've been using sqlc more and more lately, and this might be a common enough use case for us to support. |
I didn't have this use case, as I prefer sequential migrations in a single directory. So, I don't really have any strong arguments for/against. |
We are also using multiple subdirectories, and right now we need to copy them all together into to a separate temp dir before we run the migration, so we would really benefit from a new flag that would handle this use-case automatically. Please consider adding this feature. |
It has been a while since I last used goose, and now I am trying to integrate it in my current project.
Due to the way we generate our SQL code (we use a generator called sqlc), we have multiple subdirectories with schema files in them. This way is preferred by sqlc, because we can let it generate Go code, based on mixing and matching of some schemas.
Anyway, I tried migrating everything by just using a path like this
store/sql/schema/**/
, but it will not work. I know that something like this used to work in the past.What is the presently preferred way?
The text was updated successfully, but these errors were encountered: