migration synch developmental and production databases

女生的网名这么多〃 提交于 2019-11-28 14:42:45

I found a solution. The folks at Red-Gate have a great SQL tool called the SQL Compare. It compares the database file structures and even makes them EXACTLY the same, at a click of a button.

But, before you use it, be sure you ONLY compare "tables", as opposed to everything which includes "users" and "roles" and a lot more. That is because when you run the software, it backups, deletes and re-creates, and if the roles or users get deleted, the software can no longer access the database and everything gets deleted! Also... MAKE A BACKUP! (I lost all my test data on my first try)

http://www.red-gate.com/products/sql-development/sql-compare/

(This is not a sales plug for the folks at Red-Gate. I dont know them, but their tool helped me immensely - its a good tool, easy to use, and FREE for 14 days! - and I list it here so that anyone else, and I am sure there are many, who may be stuck like me can be helped.)

April 24 2015

Ok. There is more to it after you synch both the databases so that they look exactly alike.

  • Create a Back up of your production data *

  • Delete the Migration folder in your developmental folder.

  • Enable Migrations again
  • Add an initial migration
  • Update the local database
  • Now you have your local completely set up *

  • Go to the host database

  • Find the table called "__MigrationHistory" in Host/Production
  • Delete all the data (you want to purge it) ("__MigrationHistory" (Host))
  • Now copy all the data from the local "__MigrationHistory" to the hosted "__MigrationHistory" (There will be your one single line i.e. the initial one you created above")
  • Now the data has been saved and every thing will be synched and it will work. You can begin development again.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!