renameTable

abstract fun renameTable(oldTableName: String, newTableName: String)

Renames an existing table name in the database.

This function generates and executes an ALTER TABLE ... RENAME TO ... SQL statement to change the name of a table from oldTableName to newTableName.

Example

// Renames the table 'users_old' to 'users'
// Assuming the `Users` table name has been changed to 'users'
// ALTER TABLE `users_old` RENAME TO `users`;
schema
.alterTable(Users)
.renameTable("users_old", Users.tableName)

Author

MOHAMMAD AZIM ANSARI

Parameters

oldTableName

The current name of the table to be renamed.

newTableName

The new name for the table.

See also