Turning off Azure Mobile Services “soft delete”

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:

image

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:

image

Now click on the “Columns” tab on the following screen:

image

Select the __deleted column and then click “Delete” down in the command bar at the bottom of the screen:

image

From now on, when you delete a record via the native API, it will now just seamlessly delete the record with nothing else required.

Posted in Azure, Computers and Internet, General, Mobile, Security, Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2 other followers

%d bloggers like this: