Migrator
renameTable()
Signature
Section titled “Signature”renameTable() — returns void
Available in: migration
Category: Migration Functions
Description
Section titled “Description”Renames a table Only available in a migration CFC
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
oldName | string | yes | — | Name the old table |
newName | string | yes | — | New name for the table |
Examples
Section titled “Examples”// 1. Rename a table from its old name to a new name
renameTable(oldName="blogPosts", newName="posts");
// 2. Rename a table as part of a migration up/down pair
component extends="wheels.Migrator" {
function up() {
renameTable(oldName="members", newName="users");
}
function down() {
renameTable(oldName="users", newName="members");
}
}