Skip to content

Case

SQLColumnConstraintAlgorithm.primaryKey(autoIncrement:)

A PRIMARY KEY constraint, either with or without the auto-increment characteristic.
case primaryKey(autoIncrement: Bool)

Discussion

Different SQL dialects define and express auto-increment functionality in widely varying ways. For example, with SQLite, auto-increment determines the algorithm used for generating internal row identifiers, not whether or not values are autogenerated. In PostgreSQL, auto-increment implies an additional SQLColumnConstraintAlgorithm.generated(_:) column constraint. In recognition of this, a future version of this API will handle auto-increment functionality separately from primary key constraints.

If the SQL dialect does not specify support for auto-increment, the flag has no effect.

See also SQLTableConstraintAlgorithm.primaryKey(columns:).