Skip to content

database.renameTable()

Oxford Harrison edited this page Nov 10, 2024 · 5 revisions

Programmatically perform a RENAME TABLE operation.

Syntax

database.renameTable(
    fromName: string,
    toName: string,
    options?: QueryOptions
): Promise<Savepoint | boolean>;
Param Description
fromName An existing table name.
toName The intended new table name.
options Standard QueryOptions.

Return Value

  • Savepoint | boolean: a Savepoint instance (See ➞ Savepoint) or the boolean true when savepoint creation has been disabled via options.noCreateSavepoint; (Compare ➞ Query Return Value)

Usage

Rename a table:

const savepoint = await database.renameTable(
    'table_1',
    'table_1_new',
    { desc: 'Just testing table rename' }
);
Clone this wiki locally