Unique values and primary key for column wihtin database

I just started with backendless and i am trying to make a column only takes unique values, however i can’t seem to find the way to do it trough the console, neither have i been able to find how to make a column be the primary key of a table. Am i missing something very obvious?

Thank you for your responses,

Nicolas

Hi Nicolas,

You cannot do it in the console (that is configuring a column to contain unique values), however, it would be possible to implement it with custom business logic. Specifically, a data handler’s Create event can be used to check if an object already exists in the persistent storage.

We’re considering adding an ability to specify the unique constraint on a column.

Regards,
Mark

Thank you Mark,
You mean implement it with server-side code?

Is it possible to do this if i work with an external MySQL database?

Hi Nicolas,

Yes, I meant the server-side code.

It is definitely possible with an external MySQL database. That way all the data (and constraints) would stay in your database. In order to enable the “external” mode:

    login to Backendless console select your app click Data in the lower left corner there are 2 radio buttons: internal (selected) and external. Click "external" and that will prompt you to connect to your database. Once connected, you can use our Data Service API to work with your data.
Hope this helps.

Mark

Yes, that is the answer i was looking for. Thank you very much

One last question, will that connection count as an external host, or it is not counted in the number of hosts i am able to use?

Nicolas

No, that connection will not be counted as an external host.

Regards,
Mark