You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project with several "sets" of migrations, i.e. one migration "set" per distribution type (development, staging, production), as these databases can be in different stages of development and use different database providers (SQLite for local server, Azure SQL for others, etc).
I have solved this by making shell scripts that take in the environment and ultimate runs something like:
dotnet ef migrations add MigrationName --namespace=MyProject.MobileAppService.Migrations.Development --output-dir Migrations/Development --context ContextName
dotnet ef database update --namespace=MyProject.MobileAppService.Migrations.Development --context ContextName
This creates one folder in my project per environment, and allows me to have separate "migration tracks" if you will. All of this works fine, except "dotnet ef migrations add", even when specifying a --namespace, doesn't fully work. It seems to read from the first migration file it encounters and only uses --namespace for the output. This forces me to temporarily delete all migration folders except the one I want to add to when running the "dotnet migrations add" command.
So TLDR: "dotnet migrations add" uses --namespace only for output and not also for input. (dotnet ef database update works properly when --namespace is provided, so it is only the adding operation which doesn't fully work with --namespace).
Further technical details
EF Core version: 5.0.0-preview.6.20312.4
Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer): SQLite/Azure SQL Server
Target framework: (e.g. .NET Core 3.0): .NET Core 3.1
Operating system: macOS
IDE: (e.g. Visual Studio 2019 16.3): VS For Mac 8.6.5 (build 23)
Hi.
I have a project with several "sets" of migrations, i.e. one migration "set" per distribution type (development, staging, production), as these databases can be in different stages of development and use different database providers (SQLite for local server, Azure SQL for others, etc).
I have solved this by making shell scripts that take in the environment and ultimate runs something like:
This creates one folder in my project per environment, and allows me to have separate "migration tracks" if you will. All of this works fine, except "dotnet ef migrations add", even when specifying a --namespace, doesn't fully work. It seems to read from the first migration file it encounters and only uses --namespace for the output. This forces me to temporarily delete all migration folders except the one I want to add to when running the "dotnet migrations add" command.
So TLDR: "dotnet migrations add" uses --namespace only for output and not also for input. (dotnet ef database update works properly when --namespace is provided, so it is only the adding operation which doesn't fully work with --namespace).
Further technical details
EF Core version: 5.0.0-preview.6.20312.4
Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer): SQLite/Azure SQL Server
Target framework: (e.g. .NET Core 3.0): .NET Core 3.1
Operating system: macOS
IDE: (e.g. Visual Studio 2019 16.3): VS For Mac 8.6.5 (build 23)
Tangentially related feature request: #21444
The text was updated successfully, but these errors were encountered: