Migrator
integer()
Signature
Section titled “Signature”integer() — returns any
Available in: tabledefinition
Category: Table Definition Functions
Description
Section titled “Description”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.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
columnNames | string | no | — | |
limit | numeric | no | — | |
default | string | no | — | |
allowNull | boolean | no | — |
Examples
Section titled “Examples”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)