|
Deprecated. |
Connects an enum value to a database index by name. Functionally identical to @order(index: "…") with no additional capabilities; the rename happened when @order generalised the surface to include fields: and primaryKey:.
SDL signature
directive @index(name: String) on ENUM_VALUE
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
|
|
none |
Name of the database index on the enum’s parent table (resolved via the |
Canonical example
# Legacy
enum FilmOrderByField {
LANGUAGE @index(name: "IDX_FK_LANGUAGE_ID")
TITLE @index(name: "IDX_TITLE")
}
# Equivalent, modern
enum FilmOrderByField {
LANGUAGE @order(index: "IDX_FK_LANGUAGE_ID")
TITLE @order(index: "IDX_TITLE")
}
The two forms generate identical code. The migration is a mechanical rename plus a parameter shape change (name: becomes index:).
Constraints
-
Applies only to enum values, like
@order. -
namemust resolve to an existing database index when jOOQ index generation is enabled. The same "no matching index" error fires as for@order(index:). -
@indexand@ordercannot both decorate the same enum value. -
Cannot express the field-based or primary-key sorting modes available on
@order. Schemas that need those modes must migrate.
Migration
Replace each @index(name: "X") with @order(index: "X"). No runtime behaviour changes; only the directive name and parameter key.