JacekKosciesza / StarWars

GraphQL 'Star Wars' example using GraphQL for .NET, ASP.NET Core, Entity Framework Core
MIT License
621 stars 98 forks source link

Solution for error when trying to create migrations #14

Open Albert221 opened 6 years ago

Albert221 commented 6 years ago

I was getting this error (SuperChrono is the name of my solution, not StarWars) when trying to run the ef migrations command in .Data directory:

> dotnet ef migrations add Initial -o .\EntityFramework\Migrations Unable to create an object of type 'SuperChronoContext'. Add an implementation of 'IDesignTimeDbContextFactory' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.

I found a solution to specify the -s|--startup-project option pointing to your .Api directory:

> dotnet ef migrations add Initial -o .\EntityFramework\Migrations -s ..\SuperChrono.Api The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.2-rtm-30932'. Update the tools for the latest features and bug fixes. Done. To undo this action, use 'ef migrations remove'

Hope this helps someone!