mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
ENH: Support @Index platforms attribute - platform specific indexes
This is a potential alternative to using extra-dll.xml. Might be appropriate to use over extra-dll in small simple cases. We might look to extend this in the future to allow full raw platform specific ddl - the ability to specify the entire create index statement.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
/**
|
||||
* Holds multiple column unique constraints defined for an entity.
|
||||
*/
|
||||
@@ -9,12 +11,18 @@ public class IndexDefinition {
|
||||
|
||||
private final String name;
|
||||
|
||||
private final Platform[] platforms;
|
||||
|
||||
private final boolean unique;
|
||||
|
||||
public IndexDefinition(String[] columns, String name, boolean unique) {
|
||||
/**
|
||||
* Create from Index annotation.
|
||||
*/
|
||||
public IndexDefinition(String[] columns, String name, boolean unique, Platform[] platforms) {
|
||||
this.columns = columns;
|
||||
this.unique = unique;
|
||||
this.name = name;
|
||||
this.platforms = platforms;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,6 +32,7 @@ public class IndexDefinition {
|
||||
this.columns = columns;
|
||||
this.unique = true;
|
||||
this.name = null;
|
||||
this.platforms = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,4 +56,10 @@ public class IndexDefinition {
|
||||
return columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the platforms this index applies to.
|
||||
*/
|
||||
public Platform[] getPlatforms() {
|
||||
return platforms;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user