You are viewing documentation for v1.0.x. Change

primaryKey()

Description

Returns the name of the primary key for this model's table. This is determined through database introspection. If composite primary keys have been used they will both be returned in a list.

Function Syntax

primaryKey()

Parameters

None.

Examples

<!--- Get the name of the primary key of the table mapped to the `employee` model (the `employees` table by default) --->
<cfset theKeyName = model("employee").primaryKey()>