Skip to content

Migrator

renameTable()

renameTable() — returns void

Available in: migration Category: Migration Functions

Renames a table Only available in a migration CFC

NameTypeRequiredDefaultDescription
oldNamestringyes—Name the old table
newNamestringyes—New name for the table
// 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");
    }

}