Skip to content

Instantly share code, notes, and snippets.

@bennycode
Created April 15, 2018 14:30
Show Gist options
  • Select an option

  • Save bennycode/e8872ebafe9031378aa7330708e66f30 to your computer and use it in GitHub Desktop.

Select an option

Save bennycode/e8872ebafe9031378aa7330708e66f30 to your computer and use it in GitHub Desktop.
Initialize Objection.js with Knex configuration file
const config = require(`${process.cwd()}/knexfile`)[String(process.env.NODE_ENV)];
const knex = require('knex')(config);
import {Model} from 'objection';
module.exports = async () => {
await knex.migrate.latest();
Model.knex(knex);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment