Ecto.Migration: Syntax for setting a check constraint at database level

While creating an Ecto.Migration I’d like to set a constraint like this:

deadline_relative_to text not null check (deadline_relative_to in ('day', 'week'))

at the database level (postgresql in this case)

I am familiar using the Ecto.Enum data type in a scheme.

Appreciate a hint if its possible at all and if so a pointer to the documentation.

Hi! Take a look at the function to add a constraint in a migration.

1 Like

Thanks a lot. I must have been blind… :sunglasses: