简体   繁体   中英

Altering models after hosting ASP.NET MVC 5 website on server

I searched a lot for a proper answer. All answers are based on localhost. My problem is I have hosted an ASP.NET MVC 5 application on a server. I'm using Entity Framework with a code-first approach.

When I am publishing my app, I opted for run code-first migrations as I have enabled code-first migrations. Not automatic migrations. My website is using a member registration system using identity 2.

My question is: if I change some model properties and update my site from my local development environment, and when I upload new files, the models are changed... so that will have a conflict with my current database? I can't loose all data because it's user's details. I don't have any nuget consoles in server to update database.

How can I tackle such a situation? Can anyone answer me?

If you can't use code first migrations you can generate the requiered script using the script parameter for update database.

You can then add or edit statements to this script to not lose any data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM