Subscribe rss
Blog categories
All | Backendless features
How to Create a Table Schema in One Query
May 21, 2019 by Vladimir Yalovy

Create Table Schema in One Query

Today, we are going to look at a useful and interesting, but hidden, feature of Backendless. Some features like these are not covered in the documentation, so they are not recommended for use in production because they are not supported and there is no guarantee that their implementation will not change. Still, these features can be very helpful during initial development. Using these features is not for the faint of heart!

Now, daredevils, let’s get started!

For this example, we have the task of creating a table, assigning a name to it (for example, TableWithColumns ), creating a column called   StringColumn  with column type STRING , creating a column called  DoubleColumn  with column type DOUBLE , and creating a column called   NotNullStringColumn  with column type STRING  and constraints NOTNULL . You can still create columns with different constraints, separate ones, etc., but for the sake of demonstration, these items will be enough for now.

Let’s first look at the step by step process if you were to use Backendless Console.

Creating a table:

Create a Table in Backendless

Adding a StringColumn  Column:

Add a String Column to Table Schema

And we’d do the same for two more columns.

Alternately, the same can be done using console routes:

<application-id>  – the ID of your application generated upon its creation. You can obtain the value in the Manage > App Settings section of Backendless Console.

<auth-key>  – You can find this by checking the Inspect Element in your browser:

Inspect Element to find auth-key

And now the magic begins: all of the above steps can be combined into a single request!

There you have it. This action gives you the ability to create a table schema with multiple columns in a single query rather than constructing the table in the Backendless user interface. Again, we don’t suggest incorporating this functionality into your finished product, but it can be a useful function during development of your app.

Thanks for reading, and happy coding!

Share this post
Tweet about this on TwitterShare on FacebookGoogle+