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