I am utterly confused by the use of Entity Frameworks code-first migrations within Azure Mobile Services.
I\'m following the article How to make data model changes t
The specific error that you're seeing is due to the fact that EF assumes primary keys are also clustered indexes and there's no way to signal that this isn't the case. Things work when you perform automatic migrations because when the app starts, Mobile Services/Apps registers a custom SqlGenerator that removes the clustered index (along with a few other important things). This custom SqlGenerator isn't used by migrations by default.
However, you can tell your migration to use this same SqlGenerator by specifying it in the Migrations\Configuration.cs
file:
// Mobile Services namespace:
// using Microsoft.WindowsAzure.Mobile.Service.Tables
// Mobile Apps namespace:
// using Microsoft.Azure.Mobile.Server.Tables;
------
public Configuration()
{
AutomaticMigrationsEnabled = false;
SetSqlGenerator("System.Data.SqlClient", new EntityTableSqlGenerator());
}
Give that a try. The resulting db should include the CreatedAt trigger and other SQL-specific settings that Mobile Services/Apps expects. Let me know if you bump into issues doing this and I can look further.