-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Migration files in multiple folders #562
Comments
Do you plan on deploying your services independently? Are all of your services using the same database? |
The services are just and architectual style we use in our project so the services will always stay together and will use the same database. We do plan to use multiple databases but each database would have its own migrations and we would have a migrate instance for each database so that is not a problem |
You can do this by creating multiple instances of migrate.Migrate. |
If a single database is used in the project with multiple instances of migrate there will be a collision, right? Cause each instance wants a schema_migrations table in the database and also if there is multiple instances then each of them look at their own migrations. The multiple instances work for multiple databases IF each service has its own database. Correct me if im wrong but, we tried multiple instances on a sam database but if I remembed correctly it would just fail cause each instance wants its own schema_migrations table |
Are you using an RDBMS? Can you use a different database per service using the same RDBMS? e.g. call One
If you want to use a single db, you can either:
|
hello, How did you solve this problem in the end. |
Not sure if this is example what you're looking for, but this was what I used when I ran into this issue: #95 Basically set the migration table per service in the dsn when running the migration like such: |
In my projects I have a service folder and each service is inside it's separate folder. I would like to have a folder in each service that contains migrations only for the service it's in. (This looks much cleaner and it's easier to find stuff then when it's all in one folder)
And the library would take all of those folders from each of the services and take them like it's all in a single file.
Currently there is a source file that you provide when doing one of the migrate.NewWith... my suggestion would be to place the source file as a last parameter and make it a ...sourceUrl so then you can input as many sources as you would like. And the function just takes the migrations from all of the folders. This would give great flexibility to where you place migrations and how you want to structure your project.
The text was updated successfully, but these errors were encountered: