Bugfix/19601 can not add ef core migrations#19846
Conversation
|
Hi there @idseefeld, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where EF Core migrations could not be added due to missing database provider name information that was inadvertently removed in a previous commit. The fix updates the AddUmbracoDbContext extension method signatures to provide connection string and provider name parameters to configuration actions.
- Updated extension method signatures to include connection string and provider name parameters
- Modified the
UmbracoDbContextconstructor to properly resolve service providers and connection information - Updated test cases and documentation to reflect the signature changes
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| UmbracoEFCoreServiceCollectionExtensions.cs | Updated extension method signatures to provide connection string and provider name to configuration actions |
| UmbracoDbContext.cs | Enhanced constructor to resolve service providers and connection information, updated documentation |
| UmbracoEFCoreComposer.cs | Updated method call to match new signature with additional parameters |
| CustomDbContextUmbracoProviderTests.cs | Updated test cases to use new method signatures with additional parameters |
|
I have no clue😥 |
There was a problem hiding this comment.
Thanks for working on and submitting this contribution @idseefeld. I've had a look and could verify both the linked issue and that this resolves the problem.
I've pushed a couple of updates to resolve the code review comments and fix the breaking changes that were otherwise causing the build errors you were seeing.
I think it's good now, but would appreciate you having a look over to check you are happy with the updates I made. And I'll likely get a second HQ opinion too as I'm not too familiar with what has gone previously on how we are using EFCore in Umbraco.
I saw you'd also raised #19845 for the same issue but for 17. I think we can close that if we merge this one in for 16. Do you agree please or is that adding something else that I've missed?
|
@AndyButland Thank you for the fix. |
|
Great, thanks again @idseefeld - will merge this in as soon as the build checks complete. |
Prerequisites
This PR fixes #19601
Description
The issue was cause by missing database provider name which was removed in commit:
Commit d5ff803
Author: Nikolaj Brask-Nielsen nikolajgive@gmail.com
Authored Date: Mittwoch, 1. November 2023 09:59
Committer: Nikolaj Geisle 70372949+Zeegaan@users.noreply.github.com
Commit Date: Mittwoch, 1. November 2023 10:06
Parent: 107a70a
Fix custom dbcontexts extention methods (#14937)
test: Create failing test
feat: New extension methods for adding Umbraco DBContexts
test: Cleaned up integration tests
Test PR
Insure the 'src/Umbraco.Web.UI/appsettings.json' have a connection string set with the right provider e.g. SqlServer.
Open terminal for solution in Visual studio
Execute:
dotnet ef migrations add TestMigration -s src/Umbraco.Web.UI -p src/Umbraco.Cms.Persistence.EFCore.SqlServer -c UmbracoDbContextCheck migration exists
Remove migration by executing:
dotnet ef migrations remove -s src/Umbraco.Web.UI -p src/Umbraco.Cms.Persistence.EFCore.SqlServer -c UmbracoDbContext