Home Dashboard Directory Help
Search

Azure SQL - all tables removed after EntityFramework5.0 database update by ErikHoex


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 789963
Opened: 6/12/2013 12:54:38 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description



I'm build an ASP.NET webpage (on top of Azure Web Sites) with Entity Framework 5.0. I'm using Migrations to keep my database in sync with my model classes (Code First).
In the course of a few weeks I've encountered a situation where I changed a model, generated a database update script (add-migration xxxx), and executed the script. After the update, ALL TABLES are REMOVED from the SQL Azure instance. This happened 3 times in a course of 2 months. Please note that the database itself was still there.
I've ruled out 'unauthorized access' by someone else (SQL can only be managed by my ip-address).
After this happening I tried to see / research the problem, but there were no logs of any kind. Since EF handles all key constraints it seems impossible that all these tables were deleted by hand. Perhaps it's 'dropping' all tables because the foreign key in this database update script is dropped - but that's unwanted behavior.
As a solution to this problem I just rebuilt my database with the full migration scripts (the database is empty, so the migration tool will simply rebuild the database from the start).
Details
Sign in to post a comment.
Posted by ErikHoex on 9/7/2013 at 12:06 PM
It's been almost 2 months, and I have ran into this issue quite a few times after posting this bug. I just found out that it happens now even while doing SQL-queries from the SQL Management Studio. A simple update operation is now emptying up the whole database.

Isn't there anyone else with this exact issue ?
Posted by ErikHoex on 7/15/2013 at 3:25 AM
Today (a while later), this happened again, this time with the Visual Studio 2013 preview. This after I ran a migration (same like before).

All tables gone, all data gone. Something is seriously amiss.
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
All_Migration_Scripts.rar (restricted) 6/12/2013 -
201306100633045_CleanUpDatabase.cs 6/12/2013 1 KB