Skip to content

Migrator

addColumn()

addColumn() — returns void

Available in: migration Category: Migration Functions

adds a column to existing table Only available in a migration CFC

NameTypeRequiredDefaultDescription
tablestringyes—The Name of the table to add the column to
columnTypestringyes—The type of the new column
columnNamestringyes—THe name of the new column
afterColumnstringno—The name of the column which this column should be inserted after
referenceNamestringno—Name for new reference column, see documentation for references function, required if columnType is ‘reference’
defaultstringno—Default value for this column
allowNullbooleanno—Whether to allow NULL values
limitnumericno—Character or integer size limit for column
precisionnumericno—precision value for decimal columns, i.e. number of digits the column can hold
scalenumericno—scale value for decimal columns, i.e. number of digits that can be placed to the right of the decimal point (must be less than or equal to precision)