-
-
Notifications
You must be signed in to change notification settings - Fork 2
client.dropDatabase()
Oxford Harrison edited this page Nov 11, 2024
·
5 revisions
DOCS • API • Client API
Programmatically perform a DROP DATABASE operation.
See ➞ DROP DATABASE
client.dropDatabase(
name: string,
options?: DropOptions
): Promise<DDLResult>;| Param | Interfaces | Description |
|---|---|---|
name |
- | An existing database name. |
options? |
DropOptions |
Optional extra parameters for the query. |
| Interface | Description |
|---|---|
| DDLResult | The result type for DDL operations. |
type DropOptions = {
ifExists?: boolean;
cascade?: boolean;
} & QueryOptions;| Param | Interfaces | Description |
|---|---|---|
ifExists? |
- | An optional flag that adds an EXISTS check to the operation. Defaults to false. |
cascade? |
- | An optional flag that adds a CASCADE clause to the operation. Defaults to false. |
| Interface | Description |
|---|---|
| QueryOptions | Inherited options. |
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 }
);