Skip to content

Migrator

integer()

integer() — returns any

Available in: tabledefinition Category: Table Definition Functions

Adds one or more integer columns to a table definition during a migration. You can optionally specify a limit, default value, and whether the column allows NULL. Only available in migrator CFC.

NameTypeRequiredDefaultDescription
columnNamesstringno
limitnumericno
defaultstringno
allowNullbooleanno
1. Add a single integer column age
t.integer("age")

2. Add multiple integer columns height and weight
t.integer("height,weight")

3. Add an integer column quantity with a default value of 0
t.integer(columnNames="quantity", default=0)

4. Add an integer column priority that cannot be null
t.integer(columnNames="priority", allowNull=false)

5. Add an integer column rating with a limit of 2 digits (smallint)
t.integer(columnNames="rating", limit=2)

6. Add multiple columns with different limits (comma-separated)
t.integer(columnNames="smallValue,mediumValue,bigValue", limit=1)