0

Please help me understand this.

I have two .net servers: -Production -Staging

Whenever I add a new table fields to my existing DB, I have to do code first migration, I also have to add this new field to the class type in my model.cs, then I have to ask my Network admin to run the sql queries to alter table, all of this is on Staging.

Now I am ready to move to production, so I ask my network administrator to alter tables in production, and i was waiting for the site to go down as the files in

wwwroot/productionfiles

doesn't have my new changes with respect to code first migration, but the site didn't do down, the site works.

I am confused, I thought I need to follow the same steps for production as I have always followed in staging?

  • why did my production server worked only with an "alter table" for the database
  • yet my staging server always requires me to run "alter table..." for the database, then run code first migration in my code???

help me understand.

1 Answer 1

1

The Code First Migration is needed for the staging server DB to be in sync with the expected Entity Framework schema version.

In production maybe the schema version validation is skipped.

What matters in the end is that DB schema is consistent with the EF model, regardless on how that migration was made.

Sign up to request clarification or add additional context in comments.

1 Comment

I see, I actually asked my network guy to send me screen shots of the db just incase he didn't understand my request. very interesting, can i find any good read about on the web? sorry i like to understand the "whys".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.