Structure
SQLAlterTable
An expression representing an
ALTER TABLE query. Used to modify the structure of existing tables.struct SQLAlterTable
Overview
This expression is partially dialect-aware and will respect specific settings under SQLAlterTableSyntax. However, it does not handle the caae where a dialect has no table alteration support at all (such as SQLite).
ALTER TABLE "name"
RENAME TO "new_name"
ALTER TABLE "new_name"
ADD "column1" BLOB NOT NULL,
DROP "column2",
ALTER "column3" SET DATA TYPE TEXT
See SQLAlterTableBuilder.
Warning
There are numerous table alteration operations possible in various dialects which are not supported by this expression.
Topics
Initializers
init(name:)Create a table alteration query for a given table, with no operations specified to start with.
Instance Properties
addColumnsA list of zero or more new column definitions (add column operation).addTableConstraintsA list of zero or more new table constraints (add table constraint operation).dropColumnsA list of zero or more columns to remove (drop column operation).dropTableConstraintsA list of zero or more table constraint names to remove (drop table constraint operation).modifyColumnsA list of zero or more column alteration specifications (modify column operation).nameThe name of the table to alter.renameToIf notnil, a new name for the table (rename table operation).
Instance Methods
serialize(to:)Invoked when a request is made to serialize the expression to raw SQL.
Relationships
Conforms To
SQLExpressionSwift.SendableSwift.SendableMetatype
See Also
Query Expressions
SQLAlterEnumAn expression representing anALTER TYPEquery. Used to add new cases to enumeration types.SQLCreateEnumAn expression representing aCREATE TYPEquery. Used to create enumeration types.SQLCreateIndexAn expression representing aCREATE INDEXquery. Used to add indexes over columns to an existing table.SQLCreateTableAn expression representing aCREATE TABLEquery. Used to create new tables.SQLCreateTriggerAn expression representing aCREATE TRIGGERquery. Used to create new triggers for actions on a table.SQLDeleteAn expression representing aCREATE TRIGGERquery. Used to remove rows from a table.SQLDropEnumAn expression representing aDROP TYPEquery. Used to delete enumeration types.SQLDropIndexAn expression representing aDROP INDEXquery. Used to delete indexes from tables.SQLDropTableAn expression representing aDROP TABLEquery. Used to delete entire tables.SQLDropTriggerAn expression representing aDROP TRIGGERquery. Used to delete triggers.SQLInsertAn expression representing anINSERTquery. Used to add new rows to a table.SQLSelectAn expression representing aSELECTquery. Used to retrieve rows and expression results from a database.SQLUnionAn expression representing two or moreSELECTqueries joined byUNIONclauses. Used to merge the results of multiple queries into a single result set.SQLUpdateAn expression representing anUPDATEquery. Used to modify existing rows in a single table.