knex-cleaner icon indicating copy to clipboard operation
knex-cleaner copied to clipboard

Requesting Drop option

Open alexanderankin opened this issue 6 years ago • 3 comments

check out this commit, literally just asking you to plop these three lines into ur code as it is in this diff.

https://github.com/yeya/knex-cleaner/commit/fbaf1acc8b76b3d2867387d001673abbc07a9a5c

alexanderankin avatar Jan 05 '19 04:01 alexanderankin

@steven-ferguson Would you mind to help publish this change with the drop option?

clodal avatar Aug 11 '19 16:08 clodal

Happy to take a look at a PR if someone can make one.

steven-ferguson avatar Aug 13 '19 17:08 steven-ferguson

let knexTables = require('knex-cleaner/lib/knex_tables')

knexTables.getTableNames(knex)
    .then((tables) => {
        tables = tables.map((table) => {
            return `"${table}"`
        })
        return knexTables.getDropTables(knex, tables)
    })
    .then(() => {
        return knex.migrate.latest()
    })

michaelmohamed-anno avatar Aug 15 '19 16:08 michaelmohamed-anno