# UuidTable

open class UuidTable(name: String = "", columnName: String = "id") : IdTable<Uuid>

Identity table with a primary key consisting of an auto-generating kotlin.uuid.Uuid value.

Note The specific UUID column type used depends on the database. The stored identity value will be auto-generated on the client side, just before insertion of a new row, by calling `Uuid.generateV4()`. If version 7 is wanted instead, use `UuidTable(uuidVersion = UuidVersion.V7)`.

#### Parameters

name

Table name. By default, this will be resolved from any class name with a "Table" suffix removed (if present).

columnName

Name for the primary key column. By default, "id" is used.

## Constructors

UuidTable
Link copied to clipboard
constructor(name: String = "", columnName: String = "id")
constructor(name: String = "", columnName: String = "id", uuidVersion: Table.UuidVersion)

Identity table with a primary key consisting of an auto-generating kotlin.uuid.Uuid value.

## Properties

autoIncColumn
Link copied to clipboard
val autoIncColumn: Column<*>?

Returns the first auto-increment column on the table.

columns
Link copied to clipboard
open override val columns: List<Column<*>>

Returns all the columns defined on the table.

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

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

fields
Link copied to clipboard
open override val fields: List<Expression<*>>

Returns the field of this field set.

foreignKeys
Link copied to clipboard
val foreignKeys: List<ForeignKeyConstraint>

Returns all foreign key constraints declared on the table.

id
Link copied to clipboard
override val id: Column<EntityID<Uuid>>

The identity column of this UuidTable, for storing kotlin.uuid.Uuid values wrapped as EntityID instances.

idColumns
Link copied to clipboard
val idColumns: Set<Column<out Any>>

All base columns that make up this IdTable's identifier column.

indices
Link copied to clipboard
val indices: List<Index>

Returns all indices declared on the table.

options
Link copied to clipboard
open val options: List<Table.TableOption>

Table options to be appended at the very end of the CREATE TABLE statement, after the closing parenthesis of the column definitions block.

primaryKey
Link copied to clipboard
override val primaryKey: Table.PrimaryKey

Returns the primary key of the table if present, `null` otherwise.

realFields
Link copied to clipboard
open val realFields: List<Expression<*>>

Returns all real fields, unrolling composite CompositeColumn if present

schemaName
Link copied to clipboard
val schemaName: String?

Returns the schema name, or null if one does not exist for this table.

sequences
Link copied to clipboard
val sequences: List<Sequence>

Returns all sequences declared on the table, along with any auto-generated sequences that are not explicitly declared by the user but associated with the table.

source
Link copied to clipboard
open override val source: ColumnSet

Return the column set that contains this field set.

storageParameters
Link copied to clipboard
open val storageParameters: List<Table.TableStorageParameter>

Storage parameters to be included in the WITH clause at the very end of the CREATE TABLE statement, after the closing parenthesis of the column definitions block and after any table options.

tableName
Link copied to clipboard
open val tableName: String

Returns the table name.

## Functions

array
Link copied to clipboard
inline fun <E : Any> array(name: String, maximumCardinality: Int? = null): Column<List<E>>

Creates an array column, with the specified name, for storing elements of a `List`.

fun <E> array(name: String, columnType: ColumnType<E & Any>, maximumCardinality: Int? = null): Column<List<E>>

Creates an array column, with the specified name, for storing elements of a `List` using a base columnType.

inline fun <T : Any, R : List<Any>> Table.array(name: String, maximumCardinality: List<Int>? = null, dimensions: Int): Column<R>
fun <E, R : List<Any?>> Table.array(name: String, columnType: ColumnType<E & Any>, maximumCardinality: List<Int>? = null, dimensions: Int): Column<R>

Creates a multi-dimensional array column, with the specified name, for storing elements of a nested `List`. The number of dimensions is specified by the dimensions parameter.

array
Link copied to clipboard
inline fun <T : Any, R : List<Any>> Table.array(name: String, maximumCardinality: List<Int>? = null, dimensions: Int): Column<R>
fun <E, R : List<Any?>> Table.array(name: String, columnType: ColumnType<E & Any>, maximumCardinality: List<Int>? = null, dimensions: Int): Column<R>

Creates a multi-dimensional array column, with the specified name, for storing elements of a nested `List`. The number of dimensions is specified by the dimensions parameter.

autoGenerate
Link copied to clipboard
fun Column<UUID>.autoGenerate(): Column<UUID>

java.util.UUID column will auto generate its value on the client side just before an insert.

@JvmName(name = "autoGenerateKotlinUuid")
fun Column<Uuid>.autoGenerate(): Column<Uuid>

kotlin.uuid.Uuid column will auto generate its value on the client side just before an insert. By default, the new random Uuid instance will conform to the result of calling Uuid.generateV4.

fun Column<Uuid>.autoGenerate(uuidVersion: Table.UuidVersion): Column<Uuid>

kotlin.uuid.Uuid column will auto generate its value on the client side just before an insert. The new random Uuid instance will conform to the result of calling the Uuid companion method associated with the provided UuidVersion.

autoIncrement
Link copied to clipboard
fun <N : Any> Column<N>.autoIncrement(idSeqName: String? = null): Column<N>

Make @receiver column an auto-increment column to generate its values in a database. Note: Only integer and long columns are supported (signed and unsigned types). Some databases, like PostgreSQL, support auto-increment via sequences. In this case a name should be provided using the idSeqName param and Exposed will create a sequence. If a sequence already exists in the database just use its name in idSeqName.

fun <N : Any> Column<N>.autoIncrement(sequence: Sequence): Column<N>

Make @receiver column an auto-increment column to generate its values in a database. Note: Only integer and long columns are supported (signed and unsigned types). Some databases, like PostgreSQL, support auto-increment via sequences. In this case, a sequence should be provided using the sequence param.

binary
Link copied to clipboard
fun binary(name: String): Column<ByteArray>

Creates a binary column, with the specified name, for storing byte arrays of arbitrary size.

fun binary(name: String, length: Int): Column<ByteArray>

Creates a binary column, with the specified name, for storing byte arrays with the specified maximum length.

blob
Link copied to clipboard
fun blob(name: String, useObjectIdentifier: Boolean = false): Column<ExposedBlob>

Creates a binary column, with the specified name, for storing BLOBs. If useObjectIdentifier is `true`, then the column will use the `OID` type on PostgreSQL for storing large binary objects. The parameter must not be `true` for other databases.

bool
Link copied to clipboard
fun bool(name: String): Column<Boolean>

Creates a column, with the specified name, for storing boolean values.

byte
Link copied to clipboard
fun byte(name: String, checkConstraintName: String? = null): Column<Byte>

Creates a numeric column, with the specified name, for storing 1-byte integers. An optional checkConstraintName can be passed to allow customizing the check constraint name when needed.

char
Link copied to clipboard
fun char(name: String): Column<Char>

Creates a character column, with the specified name, for storing single characters.

fun char(name: String, length: Int, collate: String? = null): Column<String>

Creates a character column, with the specified name, for storing strings with the specified length using the specified text collate type. If no collate type is specified then the database default is used.

check
Link copied to clipboard
fun check(name: String = "", op: () -> Op<Boolean>)

Creates a check constraint in this table.

fun <T> Column<T>.check(name: String = "", op: (Column<T>) -> Op<Boolean>): Column<T>

Creates a check constraint in this column.

checkConstraints
Link copied to clipboard
fun checkConstraints(): List<CheckConstraint>

Returns the list of CHECK constraints in this table.

clientDefault
Link copied to clipboard
fun <T> Column<T>.clientDefault(defaultValue: () -> T): Column<T>

Sets the default value for this column in the client side.

comment
Link copied to clipboard
fun <T> Column<T>.comment(text: String): Column<T>

Adds a comment to this column that will be stored in the database schema.

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

Returns the list of DDL statements that create this object.

crossJoin
Link copied to clipboard
open infix override fun crossJoin(otherTable: ColumnSet): Join

Creates a cross join relation with otherTable.

customEnumeration
Link copied to clipboard
fun <T : Enum<T>> customEnumeration(name: String, sql: String? = null, fromDb: (Any) -> T, toDb: (T) -> Any): Column<T>

Creates an enumeration column, with the custom SQL type sql, for storing enums of type T using this database-specific type.

databaseGenerated
Link copied to clipboard
fun <T> Column<T>.databaseGenerated(): Column<T>

Marks a column as `databaseGenerated` if the default value of the column is not known at the time of table creation and/or if it depends on other columns. It makes it possible to omit setting it when inserting a new record, without getting an error. The value for the column can be set by creating a TRIGGER or with a DEFAULT clause or by using GENERATED ALWAYS AS via Column.withDefinition, for example.

decimal
Link copied to clipboard
fun decimal(name: String, precision: Int, scale: Int): Column<BigDecimal>

Creates a numeric column, with the specified name, for storing numbers with the specified precision and scale.

default
Link copied to clipboard
fun <T> Column<T>.default(defaultValue: T): Column<T>
fun <T> CompositeColumn<T>.default(defaultValue: T): CompositeColumn<T>

Sets the default value for this column in the database side.

defaultExpression
Link copied to clipboard
fun <T> Column<T>.defaultExpression(defaultValue: Expression<T>): Column<T>

Sets the default value for this column in the database side.

describe
Link copied to clipboard
open override fun describe(s: Transaction, queryBuilder: QueryBuilder)

Appends the SQL representation of this column set to the specified queryBuilder.

double
Link copied to clipboard
fun double(name: String): Column<Double>

Creates a numeric column, with the specified name, for storing 8-byte (double precision) floating-point numbers.

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

Returns the list of DDL statements that drops this object.

entityId
Link copied to clipboard
fun <T : Any> Column<T>.entityId(): Column<EntityID<T>>

Converts the @receiver column to an EntityID column.

fun <ID : Any> entityId(name: String, originalColumn: Column<ID>): Column<EntityID<ID>>

Creates an EntityID column, with the specified name, for storing the same objects as the specified originalColumn.

fun <ID : Any> entityId(name: String, table: IdTable<ID>): Column<EntityID<ID>>

Creates an EntityID column, with the specified name, for storing the identifier of the specified table.

enumeration
Link copied to clipboard
inline fun <T : Enum<T>> enumeration(name: String): Column<T>

Creates an enumeration column, with the specified name, for storing enums of type T by their ordinal.

fun <T : Enum<T>> enumeration(name: String, klass: KClass<T>): Column<T>

Creates an enumeration column, with the specified name, for storing enums of type klass by their ordinal.

enumerationByName
Link copied to clipboard
inline fun <T : Enum<T>> enumerationByName(name: String, length: Int): Column<T>

Creates an enumeration column, with the specified name, for storing enums of type T by their name. With the specified maximum length for each name value.

fun <T : Enum<T>> enumerationByName(name: String, length: Int, klass: KClass<T>): Column<T>

Creates an enumeration column, with the specified name, for storing enums of type klass by their name. With the specified maximum length for each name value.

equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
float
Link copied to clipboard
fun float(name: String): Column<Float>

Creates a numeric column, with the specified name, for storing 4-byte (single precision) floating-point numbers.

foreignKey
Link copied to clipboard
fun foreignKey(vararg references: Pair<Column<*>, Column<*>>, onUpdate: ReferenceOption? = null, onDelete: ReferenceOption? = null, name: String? = null)
fun foreignKey(vararg from: Column<*>, target: Table.PrimaryKey, onUpdate: ReferenceOption? = null, onDelete: ReferenceOption? = null, name: String? = null)

Creates a composite foreign key.

fullJoin
Link copied to clipboard
open infix override fun fullJoin(otherTable: ColumnSet): Join

Creates a full outer join relation with otherTable.

hashCode
Link copied to clipboard
open override fun hashCode(): Int
index
Link copied to clipboard
fun index(isUnique: Boolean = false, vararg columns: Column<*>)
fun index(customIndexName: String? = null, isUnique: Boolean = false, vararg columns: Column<*>, functions: List<ExpressionWithColumnType<*>>? = null, indexType: String? = null, filterCondition: FilterCondition = null)

Creates an index.

fun <T> Column<T>.index(customIndexName: String? = null, isUnique: Boolean = false): Column<T>

Creates an index composed by this column only.

innerJoin
Link copied to clipboard
open infix override fun innerJoin(otherTable: ColumnSet): Join

Creates an inner join relation with otherTable.

integer
Link copied to clipboard
fun integer(name: String, checkConstraintName: String? = null): Column<Int>

Creates a numeric column, with the specified name, for storing 4-byte integers. An optional checkConstraintName can be passed to allow customizing the check constraint name when needed.

javaUUID
Link copied to clipboard
fun Table.javaUUID(name: String): Column<UUID>

Creates a binary column, with the specified name, for storing java.util.UUID values.

join
Link copied to clipboard
open override fun join(otherTable: ColumnSet, joinType: JoinType, onColumn: Expression<*>? = null, otherColumn: Expression<*>? = null, lateral: Boolean = false, additionalConstraint: () -> Op<Boolean>? = null): Join

Creates a join relation with otherTable. When all joining options are absent Exposed will try to resolve referencing columns by itself.

joinQuery
Link copied to clipboard
fun Table.joinQuery(on: (QueryAlias) -> Op<Boolean>? = null, joinType: JoinType = JoinType.INNER, lateral: Boolean = false, joinPart: () -> AbstractQuery<*>): Join

Creates a join relation between this table and a query.

largeText
Link copied to clipboard
fun largeText(name: String, collate: String? = null, eagerLoading: Boolean = false): Column<String>

Creates a character column, with the specified name, for storing strings of large length using the specified collate type. If no collated type is specified, then the database default is used.

leftJoin
Link copied to clipboard
open infix override fun leftJoin(otherTable: ColumnSet): Join

Creates a left outer join relation with otherTable.

long
Link copied to clipboard
fun long(name: String, checkConstraintName: String? = null): Column<Long>

Creates a numeric column, with the specified name, for storing 8-byte integers. An optional checkConstraintName can be passed to allow customizing the check constraint name when needed.

mediumText
Link copied to clipboard
fun mediumText(name: String, collate: String? = null, eagerLoading: Boolean = false): Column<String>

Creates a character column, with the specified name, for storing strings of medium length using the specified collate type. If no collated type is specified, then the database default is used.

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

Returns the list of DDL statements that modify this object.

nameInDatabaseCase
Link copied to clipboard
fun nameInDatabaseCase(): String

Returns the table name in proper case. Should be called within transaction or default tableName will be returned.

nameInDatabaseCaseUnquoted
Link copied to clipboard
fun nameInDatabaseCaseUnquoted(): String

Returns the table name, without schema and in proper case, with wrapping single- and double-quotation characters removed.

nullable
Link copied to clipboard
fun <T : Any, C : CompositeColumn<T>> C.nullable(): CompositeColumn<T?>

Marks this CompositeColumn as nullable.

fun <T : Any> Column<T>.nullable(): Column<T?>

Marks this column as nullable.

nullTransform
Link copied to clipboard
@JvmName(name = "nullTransform")
fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped>.nullTransform(transformer: ColumnTransformer<Unwrapped, Wrapped?>): Column<Wrapped?>
@JvmName(name = "nullTransform")
fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped>.nullTransform(wrap: (Unwrapped) -> Wrapped?, unwrap: (Wrapped?) -> Unwrapped): Column<Wrapped?>

Applies a special transformation that allows a non-nullable database column to accept and/or return values as `null` on the client side.

optReference
Link copied to clipboard
fun <T : Any> optReference(name: String, refColumn: Column<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<T?>
@JvmName(name = "optReferenceByIdColumn")
fun <T : Any, E : EntityID<T>> optReference(name: String, refColumn: Column<E>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<E?>

Creates a column with the specified name with an optional reference to the refColumn column with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

fun <T : Any> optReference(name: String, foreign: IdTable<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<EntityID<T>?>

Creates a column with the specified name with an optional reference to the `id` column in foreign table with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

reference
Link copied to clipboard
fun <T : Any> reference(name: String, refColumn: Column<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<T>
@JvmName(name = "referenceByIdColumn")
fun <T : Any, E : EntityID<T>> reference(name: String, refColumn: Column<E>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<E>

Creates a column with the specified name with a reference to the refColumn column and with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

fun <T : Any> reference(name: String, foreign: IdTable<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): Column<EntityID<T>>

Creates a column with the specified name with a reference to the `id` column in foreign table and with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

references
Link copied to clipboard
infix fun <T : Any, S : T, C : Column<S>> C.references(ref: Column<T>): C

Creates a reference from this @receiver column to a ref column.

fun <T : Any, S : T, C : Column<S>> C.references(ref: Column<T>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): C
@JvmName(name = "referencesById")
fun <T : Any, S : T, C : Column<S>> C.references(ref: Column<EntityID<T>>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, fkName: String? = null): C

Creates a reference from this @receiver column to a ref column with onDelete, onUpdate, and fkName options. onDelete and onUpdate options describe the behavior for how links between tables will be checked when deleting or changing corresponding columns' values. Such a relationship will be represented as a FOREIGN KEY constraint on table creation.

registerColumn
Link copied to clipboard
fun <T> registerColumn(name: String, type: IColumnType<T & Any>): Column<T>

Adds a column of the specified type and with the specified name to the table.

registerCompositeColumn
Link copied to clipboard
fun <R, T : CompositeColumn<R>> registerCompositeColumn(column: T): T

Adds all wrapped column components of a CompositeColumn to the table.

replaceColumn
Link copied to clipboard
fun <TColumn : Column<*>> replaceColumn(oldColumn: Column<*>, newColumn: TColumn): TColumn

Replaces the specified oldColumn with the specified newColumn in the table. Mostly used internally by the library.

rightJoin
Link copied to clipboard
open infix override fun rightJoin(otherTable: ColumnSet): Join

Creates a right outer join relation with otherTable.

short
Link copied to clipboard
fun short(name: String, checkConstraintName: String? = null): Column<Short>

Creates a numeric column, with the specified name, for storing 2-byte integers. An optional checkConstraintName can be passed to allow customizing the check constraint name when needed.

targetTables
Link copied to clipboard
fun ColumnSet.targetTables(): List<Table>

Returns the list of tables to which the columns in this column set belong.

text
Link copied to clipboard
fun text(name: String, collate: String? = null, eagerLoading: Boolean = false): Column<String>

Creates a character column, with the specified name, for storing strings of arbitrary length using the specified collate type. If no collated type is specified, then the database default is used.

transform
Link copied to clipboard
@JvmName(name = "transformNullable")
fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped?>.transform(transformer: ColumnTransformer<Unwrapped?, Wrapped?>): Column<Wrapped?>

Transforms a nullable column by specifying a transformer.

fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped>.transform(transformer: ColumnTransformer<Unwrapped, Wrapped>): Column<Wrapped>

Transforms a column by specifying a transformer.

@JvmName(name = "transformNullable")
fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped?>.transform(wrap: (Unwrapped?) -> Wrapped?, unwrap: (Wrapped?) -> Unwrapped?): Column<Wrapped?>

Transforms a nullable column by specifying transformation functions.

fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped>.transform(wrap: (Unwrapped) -> Wrapped, unwrap: (Wrapped) -> Unwrapped): Column<Wrapped>

Transforms a column by specifying transformation functions.

ubyte
Link copied to clipboard
fun ubyte(name: String, checkConstraintName: String? = null): Column<UByte>

Creates a numeric column, with the specified name, for storing 1-byte unsigned integers. An optional checkConstraintName can be passed to allow customizing the check constraint name when needed.

uinteger
Link copied to clipboard
fun uinteger(name: String, checkConstraintName: String? = null): Column<UInt>

Creates a numeric column, with the specified name, for storing 4-byte unsigned integers. An optional checkConstraintName can be passed to allow customizing the check constraint name when needed.

ulong
Link copied to clipboard
fun ulong(name: String): Column<ULong>

Creates a numeric column, with the specified name, for storing 8-byte unsigned integers.

uniqueIndex
Link copied to clipboard
fun <T> Column<T>.uniqueIndex(customIndexName: String? = null): Column<T>

Creates a unique index composed by this column only.

fun uniqueIndex(vararg columns: Column<*>, filterCondition: FilterCondition = null)
fun uniqueIndex(customIndexName: String? = null, vararg columns: Column<*>, functions: List<ExpressionWithColumnType<*>>? = null, filterCondition: FilterCondition = null)

Creates a unique index.

ushort
Link copied to clipboard
fun ushort(name: String, checkConstraintName: String? = null): Column<UShort>

Creates a numeric column, with the specified name, for storing 2-byte unsigned integers. An optional checkConstraintName can be passed to allow customizing the check constraint name when needed.

uuid
Link copied to clipboard
fun uuid(name: String): Column<Uuid>

Creates a binary column, with the specified name, for storing kotlin.uuid.Uuid values.

varchar
Link copied to clipboard
fun varchar(name: String, length: Int, collate: String? = null): Column<String>

Creates a character column, with the specified name, for storing strings with the specified maximum length using the specified text collate type. If no collate type is specified then the database default is used.

vector
Link copied to clipboard
fun Table.vector(name: String, dimensions: Int?): Column<FloatArray>

Creates a vector column, with the specified name, for storing elements of a `FloatArray`. By default, this stores vectors with each dimension formatted as 32-bit floating-point numbers.

inline fun <T : Any> Table.vector(name: String, dimensions: Int?, format: VectorFormat? = null): Column<T>

Creates a vector column, with the specified name, for storing elements of a Kotlin primitive array, as either a `FloatArray` or an `IntArray`. By default, this stores vectors with each dimension formatted either as 32-bit floating-point numbers or as 8-bit integers.

vector
Link copied to clipboard
fun Table.vector(name: String, dimensions: Int?): Column<FloatArray>

Creates a vector column, with the specified name, for storing elements of a `FloatArray`. By default, this stores vectors with each dimension formatted as 32-bit floating-point numbers.

inline fun <T : Any> Table.vector(name: String, dimensions: Int?, format: VectorFormat? = null): Column<T>

Creates a vector column, with the specified name, for storing elements of a Kotlin primitive array, as either a `FloatArray` or an `IntArray`. By default, this stores vectors with each dimension formatted either as 32-bit floating-point numbers or as 8-bit integers.

withDefinition
Link copied to clipboard
fun <T> Column<T>.withDefinition(vararg definition: Any): Column<T>

Appends a database-specific column definition to this column's SQL in a CREATE TABLE statement.