is it possible to make migrations simplified ?

不羁岁月 提交于 2020-01-06 06:04:15

问题


During development we did such things as create table, drop index, etc in our migrations (let say we have over hundreds migrations file). Now I want to deploy on production server, could I create simplified migration like in 1 file to summary all of the changes on my development ?

to clarify I give example : migrations 1 - create table student migrations 2 - rename student_name to student_full_name migrations 3 - rename address to student_address

now I want to have a better migration file like when we create student table we already have correct field name (student with field student_full_name and student_address)

how to do that in dotnet ef core 2.1 ?


回答1:


I would try the following ( after backing up ) take note of the version number in the migrations table in the production database delete all the migrations older than that from the code set the connection string to the production database add a migration.



来源:https://stackoverflow.com/questions/53823997/is-it-possible-to-make-migrations-simplified

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!