@windingtree/wt-search-api
Version:
NodeJS app that enables quick search over data from Winding Tree platform
32 lines (28 loc) • 638 B
JavaScript
const Category = require('./models/category');
const Location = require('./models/location');
const DefaultLocale = require('./models/default-locale');
/**
* Create all necessary tables.
*
* @return {Promise<void>}
*/
const setupDB = async () => {
await Location.createTable();
await DefaultLocale.createTable();
await Category.createTable();
};
/**
* Bring the database to the initial empty state.
*
* @return {Promise<void>}
*/
const resetDB = async () => {
await Location.dropTable();
await DefaultLocale.dropTable();
await Category.dropTable();
await setupDB();
};
module.exports = {
setupDB,
resetDB,
};