You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
380 B
JavaScript
20 lines
380 B
JavaScript
const config = require('./knexfile');
|
|
const knex = require('knex')(config);
|
|
|
|
(async function () {
|
|
try {
|
|
const exists = await knex.schema.hasTable(config.migrations.tableName);
|
|
|
|
if (!exists) {
|
|
await knex.migrate.latest();
|
|
await knex.seed.run();
|
|
}
|
|
} catch (error) {
|
|
process.exitCode = 1;
|
|
|
|
throw error;
|
|
} finally {
|
|
knex.destroy();
|
|
}
|
|
})();
|