Adding a uniqueness constraint to table column

Indexes can be used to enforce uniqueness of a column’s value, or the uniqueness of the combined values of more than one column.

To add a uniqueness constraint over a column of a table:

  1. Open the API-Console and go to the Data section.

  2. Choose the SQL section in the left panel.

  3. Enter the SQL code to add a uniqueness constraint. For example, to add a uniqueness constraint over the title column of the article table, the SQL statement will look like:

    CREATE UNIQUE INDEX ON article (title);
    
  4. Check the This is a migration checkbox so that the query is saved as a migration

  5. Hit Run.