Class
SQLCreateTableBuilder
Builds
SQLCreateTable queries.final class SQLCreateTableBuilder
Topics
Initializers
init(_:on:)Create a newSQLCreateTableBuilder.
Instance Properties
columnsThe set of column definitions.createTableSQLCreateTablequery being built.databaseConnection to execute query on.queryQuery being built.
Instance Methods
check(_:named:)Add aCHECKconstraint to the table.column(_:)Add a new column definition.column(_:type:_:)Add a new column by name, type, and constraints.column(definitions:)Add multiple column definitions.foreignKey(_:references:_:onDelete:onUpdate:named:)Add aFOREIGN KEYconstraint to the table.ifNotExists()It is usually an error to attempt to create a new table in a database that already contains a table, index or view of the same name. However, if the “IF NOT EXISTS” clause is specified as part of the CREATE TABLE statement and a table or view of the same name already exists, the CREATE TABLE command simply has no effect (and no error message is returned). An error is still returned if the table cannot be created because of an existing index, even if the “IF NOT EXISTS” clause is specified.primaryKey(_:named:)Add aPRIMARY KEYconstraint to the table.select(_:)Specify aSELECTquery to be used to populate the new table.temporary()Mark the new table as temporary.unique(_:named:)Add aUNIQUEconstraint to the table.
Relationships
Conforms To
See Also
Query Builders
SQLAlterEnumBuilderBuildsSQLAlterEnumqueries.SQLAlterTableBuilderBuildsSQLAlterTablequeries.SQLConflictUpdateBuilderA builder for specifying column updates and an optional predicate to be applied to rows that caused unique key conflicts during anINSERT.SQLCreateEnumBuilderBuildsSQLCreateEnumqueries.SQLCreateIndexBuilderBuildsSQLCreateIndexqueries.SQLCreateTriggerBuilderBuildsSQLCreateTriggerqueries.SQLDeleteBuilderBuildsSQLDeletequeries.SQLDropEnumBuilderBuildsSQLDropEnumqueries.SQLDropIndexBuilderBuildsSQLDropIndexqueries.SQLDropTableBuilderBuildsSQLDropTablequeries.SQLDropTriggerBuilderBuildsSQLDropTriggerqueries.SQLInsertBuilderBuildsSQLInsertqueries.SQLPredicateGroupBuilderNestedSQLPredicateBuilderfor building expression groups.SQLRawBuilderBuilds raw SQL queries.SQLReturningResultBuilderA builder returned from the methods ofSQLReturningBuilder; this builder wraps the original builder with one which providesSQLQueryFetcherconformance. As such, thereturning(_:)methods must always be the last ones in any call chain.