Add unique columns in database schema


#1

I am using dreamfactory’s Mysql integration and the schema provided by them.
I am trying to emulate the something like this:

CREATE TABLE Persons{

LastName varchar(255) NOT NULL,
UNIQUE (LastName)

}

I couldn’t find any options to define unique columns without them being primary keys.

Can you please help?


#2

Hi @AliLubnani, you’re correct that there’s not a checkbox in the UI for this. However you may easily add these properties to the JSON view of the schema in question. Just click the JSON View button:

Then edit the column(s) as desired. For instance, to prevent null and empty values and require unique values, you could edit the schema to something like this:

is_index is also supported for general index fields.

Here is a link to the wiki page where this and related info may be found.

We have also determined it would be a good idea to add these options to the UI, so we have added that task to our development backlog.