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
tablestringyesThe Name of the table to add the column to
columnTypestringyesThe type of the new column
columnNamestringyesTHe name of the new column
afterColumnstringnoThe name of the column which this column should be inserted after
referenceNamestringnoName for new reference column, see documentation for references function, required if columnType is ‘reference’
defaultstringnoDefault value for this column
allowNullbooleannoWhether to allow NULL values
limitnumericnoCharacter or integer size limit for column
precisionnumericnoprecision value for decimal columns, i.e. number of digits the column can hold
scalenumericnoscale 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)