Skip to content

How to handle multiple schemas #1509

Answered by fubar-coder
lszczygielek asked this question in Q&A
Discussion options

You must be logged in to vote

The only way to handle this is to run the migrator with different configurations. It contains a convention set that can be customized.

Here is what needs to be done step by step:

  • Create a new service collection
  • Add the FM services
  • Add a scoped IConventionSet service
  • Build the service provider
  • Create a new service scope if needed (depends on your DI container)
  • Instantiate the IMigrationRunner
  • Call MigrateUp on the runner

Example:

// Other configuration yadda-yadda ignored
services.AddScoped<IConventionSet>(_ => new DefaultConventionSet("your-custom-schema"));
using var serviceProvider = services.BuildServiceProvider();
using var scope = serviceProvider.CreateScope();
var runner = scope.S…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lszczygielek
Comment options

@lszczygielek
Comment options

Answer selected by lszczygielek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants