I want to easily migrate my existing DB to Azure hosting. In my project I use Entity Framework DB First. Is there any lessons or examples of how to do that?
-
I don't think EF DB First approach makes any difference. Have you looked at this msdn.microsoft.com/en-us/library/windowsazure/ee730904.aspxChandermani– Chandermani2013-06-27 11:49:24 +00:00Commented Jun 27, 2013 at 11:49
-
Thanks a lot for replies, but I found a better solution. My solution is to create DB project in Visual Studio and set publish settings to publish on Azure SQL Server.Eriendel– Eriendel2013-06-27 16:11:56 +00:00Commented Jun 27, 2013 at 16:11
2 Answers
What database are you using Locally. if you're using SQL2012 or (2012 Express) there is tooling built into Management studio to allow you to Import/Export between local and azure.
Have a look at Import Data Tier Application & Export Data Tier Application for generating BACPAC files (SQL Azure equivalent of a .bak). That'll allow you to get your initial DB into SQL Azure. And to get backups back to your local environment in future.
Once you've done that, take a look at the Fluent Migrator for pushing DB First schema changes you develop locally out to your QA & Produciton Databases in azure.
Comments
You can also do this:
- Go to the Azure Management portal, click on "Databases", choose your server, click on "Configure" and give permission to your local IP to connect directly to the DB.
- Go back to your solution, and change the entry for the connection string on your web.config file to point to the azure server.
- Run "database-upgrade" from the package manager (powershell) command line to perform all migrations on the server
You can also configure your publishing profile to include the migrations on each deploy for azure. Take a look at a previous question on that subject here