TableAlteration
public final class TableAlteration
The TableAlteration class lets you alter database tables.
You don’t create instances of this class. Instead, you use the Database
alter(table:)
method:
try db.alter(table: "player") { t in // t is TableAlteration
t.add(column: ...)
}
-
Appends a column to the table.
try db.alter(table: "player") { t in t.add(column: "url", .text) }
Declaration
Swift
@discardableResult public func add(column name: String, _ type: Database.ColumnType? = nil) -> ColumnDefinition
Parameters
name
the column name.
type
the column type.
Return Value
An ColumnDefinition that allows you to refine the column definition.