Skip to content

database.renameTable()

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

DOCSAPIDatabase API


Programmatically perform a RENAME TABLE operation.

See related ➞ ALTER TABLE

Syntax

database.renameTable(
    fromName: string,
    toName: string,
    options?: AlterTableOptions
): Promise<AlterTableResult>;
Param Interfaces Description
fromName - An existing table name.
toName - The intended new table name.
options? AlterTableOptions Optional extra parameters for the operation.
Interface Description
AlterTableResult The result type for an ALTER TABLE operation.

Usage

Rename a table:

await database.renameTable(
    'table_1',
    'table_1_new',
    { desc: 'Alter description' }
);
Clone this wiki locally