-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
No Migrations? #2
Comments
Thank your for that great question @kacey90 In my opinion the best way to manage database changes is using both approaches - versioning state and versioning transitions. I wrote about this 2 articles on my blog: http://www.kamilgrzybek.com/database/database-change-management/ http://www.kamilgrzybek.com/database/using-database-project-and-dbup-for-database-management/ As you can read from second linked post I use DbUp library and raw migration scripts to create transitions. I don't use EF migrations because I want to have full control on what is applied to my database. I have not added DbUp to this repository yet because it was first release but I definitely have plan to do that :) |
@kgrzybek Thank you for your response. I'll read the articles and try to apply them myself. Many thanks again. |
Sorry that I have to reopen this. I'm trying to use DbUp to handle migrations on the project. But I'm unable to use Migrations to generate the script using "Script-Migration" on Visual Studio or dotnet ef "dotnet ef migrations script" on CLI.
I included the -verbose parameter in the command for more details and got this;
The DbContext seems pretty fine to me. Why wouldn't it work? |
In my implementation UserAccessContext does not have parameterless constructor, only this: public UserAccessContext(DbContextOptions options, ILoggerFactory loggerFactory) : base(options)
{
_loggerFactory = loggerFactory;
} So what I understand from the error message, you need to add parameterless constructor to support EF Migrations. |
Yes I noticed. And I tried the parameterless constructor but EF couldn't find the dbContextOptions as a result and threw the following error
|
I find this architecture very nice, especially because of its complexity and the modular approach you adopted. However, I noticed that there are no migrations that creates the DB models from the domain. I have read somewhere that code first migrations bring a lot of issues in enterprise level development especially in production. I feel it's why you probably didn't use it.
I see you have a database project. Does this mean I'll have to create the database and still code the domain models too? Please I need you to throw more light on this.
The text was updated successfully, but these errors were encountered: