-
-
Notifications
You must be signed in to change notification settings - Fork 2
client.dropDatabase()
Oxford Harrison edited this page Nov 15, 2024
·
5 revisions
DOCS • API • Client API
Programmatically perform a DROP DATABASE operation.
See related ➞ DROP DATABASE
client.dropDatabase(
name: string,
options?: DropOptions
): Promise<DropDatabaseResult>;| Param | Interfaces | Description |
|---|---|---|
name |
- | An existing database name. |
options? |
DropOptions |
Optional extra parameters for the query. |
type DropOptions = {
ifExists?: boolean;
cascade?: boolean;
restrict?: boolean;
} & QueryOptions;| Param | Interfaces | Description |
|---|---|---|
ifExists? |
- |
(PostgreSQL) An optional flag that adds an EXISTS check to the operation. Defaults to false. |
cascade? |
- |
(PostgreSQL) An optional flag that adds a CASCADE clause to the operation. Defaults to false. |
restrict? |
- |
(PostgreSQL) An optional flag that adds a RESTRICT clause to the operation. Defaults to false. |
| Interface | Description |
|---|---|
| QueryOptions | Inherited options. |
type DropDatabaseResult = boolean | DatabaseSchema | Savepoint | null;| Type | Interfaces | Description |
|---|---|---|
boolean |
- | The boolean true—the default result type for DDL operations without a RETURNING clause. |
DatabaseSchema |
DatabaseSchema |
For an operation with a RETURNING clause set to SCHEMA-the resulting database schema instance. |
Savepoint | null |
Savepoint |
For an operation with a RETURNING clause set to SAVEPOINT-the Savepoint instance associated with the DDL operation; null when savepoint creation has been disabled at the server level. |
See examples ➞ DROP DATABASE
Drop a database:
await client.dropDatabase(
'database_1',
{ desc: 'Drop description' }
);