question

CristinaAlbu-6434 avatar image
1 Vote"
CristinaAlbu-6434 asked ·

Automatic Migration Issue - Entity Framework

Hey, I have an issue with an Automatic migration and I could really use your guidance on this.

I have worked with someone else on a project which consists of a solution + a nu-get solution, installed in the main solution.

My colleague created some code in the Nu-get solution which generated an Automatic migration when the solution and Nu-get were deployed on other servers, but when I pulled the changes on my local and built and reloaded the application, I didn't have this Automatic migration applied in my Migration History table.

I have worked on the main solution afterwards, to do some modifications and I ALSO generated a Code First Migration, with some new columns.

When the code was deployed ( main solution with the nu-get solution installed in it) on another server, the Automatic migration didn't get applied, but the Code First migration did. Right now, the functionality from the nu-get solution doesn't work.

Do you have any thoughts why the Automatic migration wouldn't get applied on my local or on the server?

not-supported
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

What is the version of your entity framework?

0 Votes 0 · ·

The version is 6.2.0

0 Votes 0 · ·

1 Answer

IbrahimKais-9616 avatar image
0 Votes"
IbrahimKais-9616 answered ·

you should check that you enabled the automatic migration in the configuration class

please find this link to tell you more details

· 2 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The automatic migrations are enabled and he pushed the code which at build and after a run of the app, it was supposed to create the automatic one. This was the weird part..

0 Votes 0 · ·

did you specify the database initializer in the DbContext constructor?

Database.SetInitializer(new MigrateDatabaseToLatestVersion());

0 Votes 0 · ·