Instance Methodgrdb 7.4.0GRDB

notNull(onConflict:)

Adds a not null constraint.

ColumnDefinition.swift:162
@discardableResult func notNull(onConflict conflictResolution: Database.ConflictResolution? = nil) -> Self

Parameters

conflictResolution

An optional ConflictResolution.

Returns

self so that you can further refine the column definition.

For example:

// CREATE TABLE player(
//   name TEXT NOT NULL
// )
try db.create(table: "player") { t in
    t.column("name", .text).notNull()
}

Related SQLite documentation: https://www.sqlite.org/lang_createtable.html#notnullconst