# ForeignKeyConstraint

data class ForeignKeyConstraint(val references: Map<Column<*>, Column<*>>, onUpdate: ReferenceOption?, onDelete: ReferenceOption?, name: String?) : DdlAware

Represents a foreign key constraint.

## Constructors

ForeignKeyConstraint
Link copied to clipboard
constructor(target: Column<*>, from: Column<*>, onUpdate: ReferenceOption?, onDelete: ReferenceOption?, name: String?)
constructor(references: Map<Column<*>, Column<*>>, onUpdate: ReferenceOption?, onDelete: ReferenceOption?, name: String?)

## Properties

customFkName
Link copied to clipboard
val customFkName: String?

Custom foreign key name, if provided.

ddl
Link copied to clipboard
open val ddl: List<String>

Returns the list of DDL statements that create this DdlAware instance.

deleteRule
Link copied to clipboard
val deleteRule: ReferenceOption?

Reference option when performing delete operations.

fkName
Link copied to clipboard
val fkName: String

Name of this foreign key constraint.

from
Link copied to clipboard
val from: LinkedHashSet<Column<*>>

The foreign key columns of the referencing child table.

fromTable
Link copied to clipboard
val fromTable: Table

The referencing child table.

fromTableName
Link copied to clipboard
val fromTableName: String

Name of the referencing child table.

references
Link copied to clipboard
val references: Map<Column<*>, Column<*>>

Mapping of the foreign key columns in the referencing child table to their referenced parent table columns.

target
Link copied to clipboard
val target: LinkedHashSet<Column<*>>

The columns of the referenced parent table.

targetTable
Link copied to clipboard
val targetTable: Table

The referenced parent table.

targetTableName
Link copied to clipboard
val targetTableName: String

Name of the referenced parent table.

updateRule
Link copied to clipboard
val updateRule: ReferenceOption?

Reference option when performing update operations.

## Functions

createStatement
Link copied to clipboard
open override fun createStatement(): List<String>

Returns the list of DDL statements that create this object.

dropStatement
Link copied to clipboard
open override fun dropStatement(): List<String>

Returns the list of DDL statements that drops this object.

modifyStatement
Link copied to clipboard
open override fun modifyStatement(): List<String>

Returns the list of DDL statements that modify this object.

plus
Link copied to clipboard
operator fun plus(other: ForeignKeyConstraint): ForeignKeyConstraint
targetOf
Link copied to clipboard
fun targetOf(from: Column<*>): Column<*>?

Returns the parent table column that is referenced by the from column in the child table.

toString
Link copied to clipboard
open override fun toString(): String