Skip to content

Instantly share code, notes, and snippets.

@Oipo
Last active June 10, 2016 21:36
Show Gist options
  • Save Oipo/7b08a390527ba88dd7b853f0d3e96bf2 to your computer and use it in GitHub Desktop.
Save Oipo/7b08a390527ba88dd7b853f0d3e96bf2 to your computer and use it in GitHub Desktop.
const dropAllTables = async () => {
const tables = requireDir('./database/tables');
const sortedTables = _.sortBy(tables, table => -table[0].order);
_.forEach(sortedTables, async table => {
await bookshelf.knex.schema.dropTableIfExists(table[0].name);
console.log(`dropping ${table[0].name}`);
});
};
dropAllTables();
console.log('done dropping');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment