Annotation Type Index


An annotation for declaring an index.
Author:
rvbiljouw
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    When placed on the class (rather than field) you can specify the columns to include in the index in order.
    boolean
    If set true with Postgres this index should be created concurrently.
    The full raw SQL definition to create the index.
    Name of the index.
    Platforms this index applies to - default is all platforms.
    boolean
    If set true indicates this is a unique index.
  • Element Details

    • name

      String name
      Name of the index. If left blank a name is derived using the built in naming convention.
      Default:
      ""
    • unique

      boolean unique
      If set true indicates this is a unique index.
      Default:
      false
    • concurrent

      boolean concurrent
      If set true with Postgres this index should be created concurrently.

      This attribute currently only applies to Postgres applying to both the create index and drop index generated DDL.

      Default:
      false
    • columnNames

      String[] columnNames
      When 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[] platforms
      Platforms 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 definition
      The 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:
      ""