-
-
Notifications
You must be signed in to change notification settings - Fork 2
DROP TABLE
Oxford Harrison edited this page Nov 11, 2024
·
16 revisions
Drop table:
// (a): SQL syntax
const savepoint = await client.query(
`DROP TABLE database_1.table_1`,
{ desc: 'Drop description' }
);
// (b): Function-based syntax
const savepoint = await client.database('database_1').dropTable(
'table_1',
{ desc: 'Drop description' }
);
Drop conditionally:
// (a): SQL syntax
const savepoint = await client.query(
`DROP TABLE IF EXISTS database_1.table_1`,
{ desc: 'Drop description' }
);
// (b): Function-based syntax
const savepoint = await client.database('database_1').dropTable(
'table_1',
{ desc: 'Drop description', ifExists: true }
);
Drop recursively (postgres):
// (a): SQL syntax
const savepoint = await client.query(
`DROP TABLE database_1.table_1 CASCADE`,
{ desc: 'Drop description' }
);
// (b): Function-based syntax
const savepoint = await client.database('database_1').dropTable(
'table_1',
{ desc: 'Drop description', cascade: true }
);