Created
April 15, 2018 14:30
-
-
Save bennycode/e8872ebafe9031378aa7330708e66f30 to your computer and use it in GitHub Desktop.
Initialize Objection.js with Knex configuration file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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