1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 12:49:43 +02:00
planka/server/db/init.js
2019-10-01 04:18:33 +05:00

19 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();
}
})();