Skip to content

Migrator

Migrator

  • addColumn() — Adds a new column to an existing table.
  • addForeignKey() — Adds a foreign key constraint between two tables. This ensures that values in one table’s column must exist in the refer
  • addIndex() — Adds a database index on one or more columns of a table. Indexes speed up queries that filter, sort, or join on those co
  • addRecord() — Inserts a new record into a table. This function is only available inside a migration CFC and is part of the Wheels migr
  • addReference() — Adds a reference column and a foreign key constraint to a table in one step. This is a shortcut for creating an integer
  • bigInteger() — Adds one or more big integer columns to a table definition in a migration. Use this when you need columns capable of sto
  • binary() — Adds one or more binary columns to a table definition in a migration. Use this for storing raw binary data, such as file
  • boolean() — Adds one or more boolean columns to a table definition in a migration. Use this for columns that store true/false values
  • change() — Used in migrations to alter an existing table in the database. This function allows you to modify the structure of a tab
  • changeColumn() — Changes the definition of an existing column in a database table. This function is used in migration CFCs to update colu
  • changeTable() — Creates a table definition object used to store and apply modifications to an existing table in the database. This funct
  • char() — Adds one or more CHAR columns to a table definition in a migration. Use this function to define fixed-length string colu
  • column() — Adds a column to a table definition in a migration. This function is used when defining or altering database tables. It
  • create() — The create() method is used to create a database table based on the table definition that has been built using the migra
  • createMigration() — The createMigration() method is used to generate a new migration file for managing database schema changes. While you ca
  • createTable() — The createTable() function is used in migration CFCs to define a new database table. It returns a TableDefinition object
  • createView() — The createView() function is used in migration CFCs to define a new database view. It returns a ViewDefinition object, o
  • date() — date() is a table definition function used in a migration CFC to add one or more DATE columns to a table.
  • datetime() — Adds datetime columns to a table definition when creating or altering a table in a migration. These columns store both d
  • decimal() — Adds decimal (numeric) columns to a table definition when creating or altering tables via a migration CFC.
  • down() — down() defines the steps to revert a database migration. It’s executed when rolling back a migration, typically to undo
  • dropForeignKey() — dropForeignKey() is used to remove a foreign key constraint from a table in the database. This is typically done during
  • dropReference() — dropReference() is used to remove a foreign key constraint from a table in the database using the reference name that wa
  • dropTable() — dropTable() is used to remove a table from the database entirely. This is a destructive operation, so all data in the ta
  • dropView() — dropView() is used to remove a database view entirely. A view is a saved query that acts like a virtual table, so this o
  • execute() — execute() allows you to run a raw SQL query directly from a migration file. This is useful when you need to perform oper
  • float() — The float() function is used in a table definition during a migration to add one or more float-type columns to a databas
  • getAvailableMigrations() — The getAvailableMigrations() function scans the migration folder (by default /app/migrator/migrations/) and returns an a
  • getCurrentMigrationVersion() — The getCurrentMigrationVersion() function returns the version number of the latest migration that has been applied to th
  • integer() — Adds one or more integer columns to a table definition during a migration. You can optionally specify a limit, default v
  • migrateTo() — Migrates the database schema to a specified version. This function is primarily intended for programmatic database migra
  • migrateToLatest() — Migrates the database schema to the latest available migration version. This is a shortcut for migrateTo(version) withou
  • primaryKey() — Used inside migration table definitions to define a primary key for the table. By default, it creates a single-column in
  • redoMigration() — Allows you to rerun a specific database migration version. This can be useful for testing migrations, correcting issues
  • references() — Used when defining a table schema to add reference columns that act as foreign keys, linking the table to other tables i
  • removeColumn() — Used to delete a column from a database table within a migration CFC. This is useful when you need to remove obsolete or
  • removeIndex() — Used to delete an index from a database table within a migration CFC. Indexes are typically added to improve query perfo
  • removeRecord() — Used to delete specific records from a database table within a migration CFC. This is useful when you need to clean up o
  • renameColumn() — Used to change the name of an existing column in a database table within a migration CFC. This is useful when you need t
  • renameTable() — Used to change the name of an existing database table within a migration CFC. This is helpful when you want to standardi
  • string() — Used to add one or more string (VARCHAR) columns to a database table. It supports specifying default values, nullability
  • text() — Used within a migration to add one or more text columns to a database table definition. Text columns are designed for st
  • time() — Adds one or more TIME columns to a table definition in a migration. Only available in a migrator CFC.
  • timestamp() — Used to add one or more TIMESTAMP (or DATETIME) columns to a table definition. It lets you spe
  • timestamps() — Shortcut for adding Wheels’ convention-based automatic timestamp and soft delete columns to a table definition during mi
  • uniqueidentifier() — Used to add one or more UUID (Universally Unique Identifier) columns to a table definition. These columns are useful for
  • up() — Defines the actions to migrate your database schema forward. It is called when applying a migration and is typically pai
  • updateRecord() — Allows you to update an existing record in a database table directly from within a migration CFC. This function is parti