Class MCompoundForeignKey
- java.lang.Object
-
- io.ebeaninternal.dbmigration.model.MCompoundForeignKey
-
public class MCompoundForeignKey extends Object
A unique constraint for multiple columns.Note that unique constraint on a single column is instead a boolean flag on the associated MColumn.
-
-
Constructor Summary
Constructors Constructor Description MCompoundForeignKey(String name, String referenceTable, String indexName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumnPair(String dbCol, String refColumn)
Add a column pair of local and referenced column.AlterForeignKey
addForeignKey(String tableName)
Create and return an AlterForeignKey migration element.void
addNameSuffix(int counter)
Add a counter to the foreign key and index names to avoid duplication.ForeignKey
createForeignKey()
Create and return an ForeignKey migration element.AlterForeignKey
dropForeignKey(String tableName)
Create and return an AlterForeignKey migration element.boolean
equals(Object obj)
List<String>
getColumns()
Return the columns making up the foreign key in order.String
getIndexName()
Return the index name.String
getName()
Return the foreign key name.int
hashCode()
void
setIndexName(String indexName)
Set the associated index name.
-
-
-
Constructor Detail
-
MCompoundForeignKey
public MCompoundForeignKey(String name, String referenceTable, String indexName)
-
-
Method Detail
-
addColumnPair
public void addColumnPair(String dbCol, String refColumn)
Add a column pair of local and referenced column.
-
createForeignKey
public ForeignKey createForeignKey()
Create and return an ForeignKey migration element.
-
addForeignKey
public AlterForeignKey addForeignKey(String tableName)
Create and return an AlterForeignKey migration element.
-
dropForeignKey
public AlterForeignKey dropForeignKey(String tableName)
Create and return an AlterForeignKey migration element.
-
addNameSuffix
public void addNameSuffix(int counter)
Add a counter to the foreign key and index names to avoid duplication.
-
getIndexName
public String getIndexName()
Return the index name.
-
getColumns
public List<String> getColumns()
Return the columns making up the foreign key in order.
-
setIndexName
public void setIndexName(String indexName)
Set the associated index name. Note that setting to null has the effect of indicating an associated index should not be created for this foreign key.
-
-