Skip to content
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

Initial database migration not working using OrderingContext #543

Open
akinzo1 opened this issue Sep 22, 2024 · 0 comments
Open

Initial database migration not working using OrderingContext #543

akinzo1 opened this issue Sep 22, 2024 · 0 comments

Comments

@akinzo1
Copy link

akinzo1 commented Sep 22, 2024

The instruction in OrderingContext.cs says to run
dotnet ef migrations add --startup-project Ordering.API --context OrderingContext [migration-name].

However, no migrations are added. I have modified the above command to startup on Ordering.Infrastructure (which I think is what you guys meant), but still no luck. I'm trying to do this from a dotnet maui project that uses aspire to orchestrate apis, worker processes and db. Everything is great, except that I cannot get EF to create the initial tables.

when I run dotnet ef migrations add MyNewMigration --project Ordering.Infrastructure\Ordering.Infrastructure.csproj --context Ordering.Infrastructure.OrderingContext

I get the following error -
dotnet : The specified deps.json [C:\app\bin\Debug\net8.0-android\app.deps.json] does not exist

NOTE:

  1. The db gets created, but the tables dont (because of missing migrations)
  2. When I copy over the existing Migrations from the eShop sln to mine, the tables get created. However, it would suck having to manually update the migrations to meet my needs
  3. The real question is - How did you create the initial migrations in Ordering.Infrastructure. This is what I really need as my code is 100% identical to eShop

Can you please advise?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant