An annotation for declaring an index.
- Author:
- rvbiljouw
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]When placed on the class (rather than field) you can specify the columns to include in the index in order.booleanIf set true with Postgres this index should be created concurrently.The full raw SQL definition to create the index.Name of the index.Platform[]Platforms this index applies to - default is all platforms.booleanIf set true indicates this is a unique index.
-
Element Details
-
name
String nameName of the index. If left blank a name is derived using the built in naming convention.- Default:
- ""
-
unique
boolean uniqueIf set true indicates this is a unique index.- Default:
- false
-
concurrent
boolean concurrentIf set true with Postgres this index should be created concurrently.This attribute currently only applies to Postgres applying to both the
create indexanddrop indexgenerated DDL.- Default:
- false
-
columnNames
String[] columnNamesWhen placed on the class (rather than field) you can specify the columns to include in the index in order.When placed on a field, and columnNames are specified, the field-column has to be included. You can use "${fa}" for alias.
- Default:
- {}
-
platforms
Platform[] platformsPlatforms this index applies to - default is all platforms.This provides an alternative to using extra-dll.xml to specify platform specific index ddl.
Changing platforms is NOT detected as part of DB migration generation (no platform specific DIFF) so using extra-ddl.xml may be preferred.
- Default:
- {}
-
definition
String definitionThe full raw SQL definition to create the index.The indexName should be provided such that the drop index statement can be generated as needed.
This allows for platform specific index creation features as an alternative to using ebean extra-dll.xml to define extra potentially platform specific DDL.
@Index(name = "ix_t_detail_defn", definition = "create index ix_t_detail_defn on t_detail using hash (lower(name)) where lower(name) like 'r%'", platforms = Platform.POSTGRES)- Default:
- ""
-