Skip to content

database.renameTable()

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

DOCSAPIDatabase API


Programmatically perform a RENAME TABLE operation.

See ➞ ALTER TABLE

Syntax

database.renameTable(
    fromName: string,
    toName: string,
    options?: QueryOptions
): Promise<DDLResult>;
Param Interfaces Description
fromName - An existing table name.
toName - The intended new table name.
options QueryOptions Optional extra parameters for the query.
Interface Description
DDLResult The result type for DDL operations.

Usage

Rename a table:

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