-
-
Notifications
You must be signed in to change notification settings - Fork 2
database.dropTable()
Oxford Harrison edited this page Nov 10, 2024
·
5 revisions
Programmatically perform a DROP TABLE operation.
database.dropTable(
name: string,
options?: DropOptions
): Promise<Savepoint | boolean>;| Param | Description |
|---|---|
name |
An existing table name. |
options |
Extra parameters for the query—which extends standard QueryOptions. |
└ DropOptions
| Param | Applicable to | Description |
|---|---|---|
ifExists |
A flag to conditionally drop the table. | |
cascade |
A flag to force-drop the table along with its dependent objects. |
- A Savepoint instance (See ➞
Savepoint) or the booleantruewhen savepoint creation has been disabled viaoptions.noCreateSavepoint; (Compare ➞ Query Return Value)
Drop a table:
const savepoint = await database.dropTable(
'table_1',
{ desc: 'Dropping for test purposes' }
);Force-drop, if exits:
const savepoint = await database.dropTable(
'table_1',
{ desc: 'Dropping for test purposes', ifExists: true, cascade: true }
);