@onurege3467/zerohelper
Version:
ZeroHelper is a versatile JavaScript library offering helper functions and database utilities for developers. It supports MongoDB, MySQL, SQLite, Redis, and PostgreSQL.
13 lines (10 loc) • 442 B
JavaScript
;
const errors = require('../errors/strings.js');
module.exports = async function(table, isClear){
if(!table || typeof table !== "string") throw new TypeError(errors.table.replace("{received}", typeof table));
let tables = await this.tables();
if(!tables.includes(table)) return false;
await this.db.query(`DROP TABLE \`${table}\``);
if(tables.includes(table) && !isClear) this.emit("tableDelete", table);
return true;
}