renameColumn

abstract fun renameColumn(oldColumnName: String, newKQLiteColumn: KQLiteColumn<*>)

Renames an existing column name in a table.

This function generates and executes an ALTER TABLE ... RENAME COLUMN ... TO ... SQL statement. The new column name is derived from the provided newKQLiteColumn.

Example

// Renames the column 'first_name' to 'fullName'
// Assuming the `Users` table object now has a `fullName` column definition
// with updated column name as 'fullName'.

// ALTER TABLE `Users` RENAME COLUMN `first_name` TO `fullName`;
schema
.alterTable(Users)
.renameColumn("first_name", Users.fullName)

Author

MOHAMMAD AZIM ANSARI

Parameters

oldColumnName

The current name of the column to be renamed.

newKQLiteColumn

The KQLiteColumn instance representing the column with its new name. The columnName property of this object will be used as the new name for the column.

See also