How can I make a field in a dataset force unique entries?

I want to make a column in my database only allow for unique entries, any ideas on how I can do this in Bubble? Couldn’t find anything in the docs.

Thanks

When adding a thing to that table, add a condition to the action to check whether the thing you’re going to add is unique (i.e., the list of thing’s values doesn’t contain current thing’s value).

2 Likes

Is this really the only way to do this?

This approach means, of course, that the constraint is done by the condition on the action and not by any condition placed on the database table/field. And therefore ALL actions affecting that field will have to impose the same condition. This seems very developer-error-prone.

Is there no other/better way to do this?

For example, such as to add a trigger to the database that throws an error when an attempt is made to add a non-unique value to a supposed-to-be unique field – and to then somehow catch that error so that it can be handled.

Or, in other words, is there no equivalent (in Bubble) of the common model (in other development languages) for throwing, catching and handling exceptions?