As soon as you have data in a persistent storage, the question of searching would be one of the first to come up. Indeed, how can you query the backend for data? We considered multiple options and settled on the most popular one – SQL. However, we had to take a few shortcuts to allow SQL searches – the most notable is you can use only the “where” part of an SQL query to search for your data. Consider the following data table:
Backendless can create tables when you store object hierarchies from a client application. Also, I described how to manually create data tables using Backendless console. Finally, there is one more approach which makes table creation as simple as it gets. The approach is by uploading a file which contains schema definition for every table. The schema definition may include data types for all columns, including the ones for relations. As a part of my quest to build a restaurant to-go order app, I created all the tables in my Backendless backend. I used the schema export feature (to be discussed in the future) which generated for me a ZIP file with the schema definitions for all the tables used by the app.
A few posts ago I published a proposed schema for the database design for a sample app which can process mobile to–go orders. As the first step in building the application, I put together a rather simplistic user interface mockup for the future app. You can see the mockup below:
The next step will be a series of posts where we design the client-side of the app for Android and iOS. Additionally, we will be exploring and reviewing various Backendless features as we move along.
In my post yesterday I showed how to declare relationships between tables. Once a relationship is in place, specific objects stored in the tables may be linked with each other. This linkage may be expressed through the code, where the instances of classes reference each other through the composition method. However, there are scenarios where these relationships may need to be created directly in the storage system. Backendless console is the development tool that lets you manage it using a graphical interfaces. The types of relationships you can build by hand can be either one-to-one or one-to-many. As a result of establishing a relationship between any two or more objects, you can retrieve the related objects using the API. For instance, in the example below a restaurant object will have a relationship with one or more location. When the restaurant object is retrieved via an API call, all the related locations can be retrieved as well.
In my of my previous posts I described how to add columns/properties to a Backendless table/class using console. The types of properties reviewed in that post were all primitive: string, numbers, dates or boolean values. In addition to these data types, Backendless also supports relationships between objects stored in its persistent storage. These relationships are classic composition types in the object-oriented world. That means a table may declare a property (column) which references either one or a collection of objects from another (or the same) table. When these objects are materialized on the client-side (assuming the language supports object-oriented programming), the properties simply reference related objects.
When a user registers for your app, it is quite common to make sure he provided a valid email address. Typically this is done by sending a URL to the user’s email address and ask him to follow the link. Once the link is opened in a browser, it serves as a confirmation of a valid email address. This is rather standard functionality of an application’s backend. Backendless makes it very easy to configure this behavior for any application powered by our platform. To configure email confirmations for your app:
Backendless database provides a very simple, but powerful API for storing, searching, updating or deleting application objects. The “feature 1” post demonstrates how to save objects with relations in Backendless using the APIs. In this post I will describe how to add new objects in the database using Backendless console. This might be helpful if you need to set up some test data, or perhaps enter some static values which are not meant to be entered through the API in an application.
If you do not have a table, you can create it using the console as well (see the how to create data tables using Backendless console post). To add a new object:
In the previous feature highlight I described how to manually create data tables in Backendless console. In this post I will show how to setup a data table schema. A table schema in Backendless is a collection of table columns. Each column may have the following attributes:
To access the schema editor tool:
Schema management includes a lot more tasks than just creating table columns. In the future posts we will be reviewing the following:
As we are progressing with the feature a day blog series, I thought it would be a good idea to come up with a fictional app which I could use in the feature posts. The idea for the app I will use as an example is a restaurant ordering system. Using the app a customer (who would need to register and login) can choose a restaurant, browse the menu and submit an order. A restaurant owner would be able to login and see the orders. Additionally, the owner would be able to run a report to calculate daily revenue. The design for the app will be evolving as we go, however to start with something I put together a class diagram which shows the core entities present in the system:
There are plenty of things we can add to the application. I can think of restaurant/menu recommendations, customer reviews, integration with payment systems, etc. This should be fun!
The article which shows how to store objects in Backendless also demonstrated dynamic data table creation. That approach is called “code first” – where the code dictates the database schema. However, a more traditional approach where you create the tables first and then write code which works with them is also supported by our platform. Creating data tables in Backendless is trivially simple. Please follow the instructions below: