How to change the output folder for migrations with asp.net Core?

DenLilleMand picture DenLilleMand · Nov 19, 2016 · Viewed 39.6k times · Source

Does anyone know how to change the output directory of the following command?

dotnet ef  migrations add Initial --context EsportshubApi.Models.ApplicationDbContext

I tried to add the option:

--content-root-path 'Migrations/Identity' 

But that doesn't do anything. There is a --data-dir option as well and something else with directory. But none of them is the output for migrations.

My problem is that I have 2 DbContexts so I want their migrations to be separated.

Answer

Jérôme MEVEL picture Jérôme MEVEL · Nov 21, 2016
dotnet ef migrations add Initial --context EsportshubApi.Models.ApplicationDbContext -o YourFolderPath

Source

dotnet ef migrations add

Adds a new migration.

Arguments:

< NAME >        The name of the migration.

Options:

-o        --output-dir < PATH >        The directory (and sub-namespace) to use. Paths are relative to the project directory. Defaults to "Migrations".