What’s the biggest problem on the Internet? You can’t delete anything. Ever. Well, doing their part in that, Azure Mobile Services has a “soft delete” feature for each table, enabled by default. You may not have noticed it when you created a table:
This means that the record isn’t delete – it’s just marked for deletion at a later time, but the end-user can’t get to it. As an end-user, don’t you hate that!?
In your case as a developer, this might be useful or even legally necessary. However, for my app, I just want to actually, physically delete a record when the user attempts to “delete a record”.
Before I go on, there actually is an upside to soft delete. You could add “undo” or “trash bin” functionality and then permanently delete it later (like 30 days later, if they haven’t undeleted it). So, there are some interesting options.
Again though, I just want to simply delete a record, not mark it as deleted.
By default, soft delete is turned on. This means you will have an “__deleted” bit flag (field) in the table. When you run a .del() operation, it will set the __deleted to true. The only way to delete the record now is via a SQL query or running a web job.
So instead, to turn off soft delete – remove that column. In the Azure Portal for your Mobile Service, click on the “Data” tab:
Now click on the “Columns” tab on the following screen:
Select the __deleted column and then click “Delete” down in the command bar at the bottom of the screen:
From now on, when you delete a record via the native API, it will now just seamlessly delete the record with nothing else required.