prisma icon indicating copy to clipboard operation
prisma copied to clipboard

Sort by Enum Field(s) alphabetically

Open fgrande opened this issue 9 months ago • 1 comments

Problem

Today sorting by enum field(s) means order data by its integer value. There are cases when data needs to be ordered by the String defined by the enum In PostGres this is possible through the modifier "::text", for example : ORDER BY myEnumField::text

Suggested solution

Associate a new SortOrderEnum class to enum fields, where a property sortMode can define if sort by Name or Value of the enum

fgrande avatar May 08 '24 12:05 fgrande

This seems to be possible on mysql as well

Druue avatar May 08 '24 17:05 Druue