Gary McNeill
Gary McNeill

Reputation: 103

How do I relate tables in Azure Mobile Service - Javascript Backend

On the azure page I can create my tables but there are only 4 data types and no option to create or relate the tables using foreign keys and SQL.

What I want to do is have a user and contact table with userId in contact table as a foreign key.

I am using apache cordova and angularJs on the front end in visual studio. I have already added the mobile service to my project.

Upvotes: 0

Views: 135

Answers (1)

lindydonna
lindydonna

Reputation: 3875

Mobile Services does not directly support relationships in the backend, but you can customize the data using server scripts and the mssql object. Alternatively, you can create database views that have relationships between tables.

For an example of mapping relationships using database views, please see my post in this forum thread: Best Practice For Syncing Related Tables in Offline Mode.

For more information on managing the database directly, see this article: Scale mobile services backed by Azure SQL Database.

Upvotes: 1

Related Questions