简体   繁体   中英

How to deploy migrations to deployment site

My question is if I create a migration on development site, do I need to create it also manually via command line on the deployment site? If not, how do the migrations transfer from the development site to the deployment site?

You can either do this during a Publish by setting "Execute Code First Migrations" in the publish profile: 通过代码优先迁移发布配置文件

Or you can change your database connection string in your project to the deployment site and then run Update-Database which will run using that connection string.

You can avoid managing the string via the app.config (or Web.config) by explicitly naming the connection string as in this answer: https://stackoverflow.com/a/10724679/2347118

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