Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gimenete

gimenete/drop.js Secret

Created October 22, 2016 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gimenete/f9cc26d9e2fa7f85ed597df71609e40a to your computer and use it in GitHub Desktop.
Save gimenete/f9cc26d9e2fa7f85ed597df71609e40a to your computer and use it in GitHub Desktop.
dropTables () {
return this.find(`
SELECT concat('DROP TABLE IF EXISTS ', table_name, ';') AS fullSQL
FROM information_schema.tables
WHERE table_schema = ?;
`, [this.options.database])
.then((results) => {
var sql = results.map((result) => result.fullSQL).join(' ')
return sql && this.query(sql)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment