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

Get Docker working for local development - SQL not working #136

Closed
sadukie opened this issue Jan 24, 2025 · 2 comments
Closed

Get Docker working for local development - SQL not working #136

sadukie opened this issue Jan 24, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@sadukie
Copy link
Contributor

sadukie commented Jan 24, 2025

Problem

I was hoping I could avoid installing LocalDB by running the Docker version of this. However, I'm running into issues.

I'm getting this error:

SqlException: Cannot open database "Microsoft.eShopOnWeb.CatalogDb" requested by the login. The login failed. Login failed for user 'sa'.

This is what I see when I try to connect to the MVC app in the Docker Container:

Image

The EF migrations can't be applied because the databases don't exist for the Catalog nor for Identity.

Additional Notes

We need to create the databases for the EF contexts. We also need to run the migrations for this to work for Docker.

@sadukie sadukie added the bug Something isn't working label Jan 24, 2025
@sadukie sadukie self-assigned this Jan 24, 2025
@sadukie
Copy link
Contributor Author

sadukie commented Jan 24, 2025

More notes...

  • There are calls to .Database.Migrate() in the SeedAsync() calls. These should be creating the database if it doesn't exist but do not appear to be working in the Docker setup.
  • I looked at bringing in .Database.EnsureCreated(), which did create the databases... but... EnsureCreated and Migrate don't work together.

@sadukie
Copy link
Contributor Author

sadukie commented Feb 8, 2025

This appears to be working now. @Coop56 also confirmed it working locally as well. So updates have got this in a better spot.

@sadukie sadukie closed this as completed Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant