Reputation: 7923
I have a website which runs in Azure, using an Azure database. My development database however is an .mdf
file. Because the data is constantly changing in the Azure database, I would like to be able to grab an snapshot of the data in order to have a newer representation of the data in my local .mdf
file. Because my code also inserts data into the database, I cannot simply connect to the production database from my local machine.
The reason I have an .mdf
file is because I can package it with the code in source control. That way I do not have to provide an external test database when I move between machines (I am the only developer).
Is it possible to somehow convert a database in SQL Server database in Microsoft SQL Server Management Studio to a .mdf
file? Or have a query which synchronizes the data by copying it out of one and into the other database?
One of the reasons I want to be able to synchronize the Azure database with my .mdf
file is so that I do not have to package in source control (they can get pretty big), but rather generate one any time I need an .mdf
database to test with. I would rather not have a remote test database to connect to for development if I do not have to.
It seems like I have over complicated things for myself. Are there better approaches to this than using an .mdf
database? Is there a different approach to duplicating a production database for testing?
Upvotes: 1
Views: 594
Reputation: 6856
This is what I would do:
Doing this will mean that you can actually track changes in source control and you get a FREE automatic deployment system.
What this won't give you is the snapshot of the production data, to get that you could create an ssis package that copies all the tables you need - but for testing you should be able to (and indeed many of us do) just use a clean database to develop / test on and just pull down specific bits of data when we are debugging issues.
Upvotes: 3