ColumnDefinition
public final class ColumnDefinitionThe ColumnDefinition class lets you refine a table column.
You get instances of this class when you create or alter a database table:
try db.create(table: "player") { t in
    t.column(...)      // ColumnDefinition
}
try db.alter(table: "player") { t in
    t.add(column: ...) // ColumnDefinition
}
See https://www.sqlite.org/lang_createtable.html and https://www.sqlite.org/lang_altertable.html
- 
                  
                  Adds a primary key constraint on the column. try db.create(table: "player") { t in t.column("id", .integer).primaryKey() }See https://www.sqlite.org/lang_createtable.html#primkeyconst and https://www.sqlite.org/lang_createtable.html#rowid DeclarationSwift @discardableResult public func primaryKey( onConflict conflictResolution: Database.ConflictResolution? = nil, autoincrement: Bool = false) -> SelfParametersconflictResolutionAn optional conflict resolution (see https://www.sqlite.org/lang_conflict.html). autoincrementIf true, the primary key is autoincremented. Return ValueSelf so that you can further refine the column definition. 
- 
                  
                  Adds a NOT NULL constraint on the column. try db.create(table: "player") { t in t.column("name", .text).notNull() }See https://www.sqlite.org/lang_createtable.html#notnullconst DeclarationSwift @discardableResult public func notNull(onConflict conflictResolution: Database.ConflictResolution? = nil) -> SelfParametersconflictResolutionAn optional conflict resolution (see https://www.sqlite.org/lang_conflict.html). Return ValueSelf so that you can further refine the column definition. 
- 
                  
                  Adds a UNIQUE constraint on the column. try db.create(table: "player") { t in t.column("email", .text).unique() }See https://www.sqlite.org/lang_createtable.html#uniqueconst DeclarationSwift @discardableResult public func unique(onConflict conflictResolution: Database.ConflictResolution? = nil) -> SelfParametersconflictResolutionAn optional conflict resolution (see https://www.sqlite.org/lang_conflict.html). Return ValueSelf so that you can further refine the column definition. 
- 
                  
                  Adds an index of the column. try db.create(table: "player") { t in t.column("email", .text).indexed() }See https://www.sqlite.org/lang_createtable.html#uniqueconst DeclarationSwift @discardableResult public func indexed() -> SelfReturn ValueSelf so that you can further refine the column definition. 
- 
                  
                  Adds a CHECK constraint on the column. try db.create(table: "player") { t in t.column("name", .text).check { length($0) > 0 } }DeclarationSwift @discardableResult public func check(_ condition: (Column) -> SQLExpressible) -> SelfParametersconditionA closure whose argument is an Column that represents the defined column, and returns the expression to check. Return ValueSelf so that you can further refine the column definition. 
- 
                  
                  Adds a CHECK constraint on the column. try db.create(table: "player") { t in t.column("name", .text).check(sql: "LENGTH(name) > 0") }DeclarationSwift @discardableResult public func check(sql: String) -> SelfParameterssqlAn SQL snippet. Return ValueSelf so that you can further refine the column definition. 
- 
                  
                  Defines the default column value. try db.create(table: "player") { t in t.column("name", .text).defaults(to: "Anonymous") }DeclarationSwift @discardableResult public func defaults(to value: DatabaseValueConvertible) -> SelfParametersvalueA DatabaseValueConvertible value. Return ValueSelf so that you can further refine the column definition. 
- 
                  
                  Defines the default column value. try db.create(table: "player") { t in t.column("creationDate", .DateTime).defaults(sql: "CURRENT_TIMESTAMP") }DeclarationSwift @discardableResult public func defaults(sql: String) -> SelfParameterssqlAn SQL snippet. Return ValueSelf so that you can further refine the column definition. 
- 
                  
                  try db.create(table: "player") { t in t.column("email", .text).collate(.nocase) }DeclarationSwift @discardableResult public func collate(_ collation: Database.CollationName) -> SelfParameterscollationAn Database.CollationName. Return ValueSelf so that you can further refine the column definition. 
- 
                  
                  try db.create(table: "player") { t in t.column("name", .text).collate(.localizedCaseInsensitiveCompare) }DeclarationSwift @discardableResult public func collate(_ collation: DatabaseCollation) -> SelfParameterscollationA custom DatabaseCollation. Return ValueSelf so that you can further refine the column definition. 
- 
                  
                  Defines a foreign key. try db.create(table: "book") { t in t.column("authorId", .integer).references("author", onDelete: .cascade) }DeclarationReturn ValueSelf so that you can further refine the column definition. 
 View on GitHub
View on GitHub Install in Dash
Install in Dash ColumnDefinition Class Reference
        ColumnDefinition Class Reference