I tried to use the ENUM fields for PostgreSQL in the database migration of Laravel.
$table->enum('status', ['open', 'treatment', 'postponed', 'closed']);
But when I execute it I get a varchar(255) in stead of an Enum field.
Is there a Laravel way to create those fields? Or am I doing something wrong?
For anyone that comes across this, like I did myself, it creates a varchar(255) column and adds a constraint to allow only the specified strings.
return "varchar(255) check (\"{$column->name}\" in (".implode(', ', $allowed)."))";
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community