-
-
Notifications
You must be signed in to change notification settings - Fork 2
database.dropTable()
Oxford Harrison edited this page Nov 11, 2024
·
5 revisions
DOCS • API • Database API
Programmatically perform a DROP TABLE
operation.
See ➞ DROP TABLE
database.dropTable(
name: string,
options?: DropOptions
): Promise<DDLResult>;
Param | Interfaces | Description |
---|---|---|
name |
- | An existing table 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 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 }
);