Knex CLI
Last updated 2 years ago by fpasquet-elevenlabs .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @elevenlabs/knex-cli -g
SYNC missed versions from official npm registry.

Knex Cli


Have the config file knexfile.js at the root of the project.

Example config:

'use strict';

const config = {
    dev: {
        client: 'mysql',
        connection: process.env.DB_URL,
        migrations: {
            directory: __dirname + '/migrations'
        seeds: {
            directory: __dirname + '/seeds'

module.exports = config;

And if you want to use a JSON config that will set your variables in process. Env, you must create the config file for the environments that you are going to use, it contains the identification parameters to the database.

Example for the dev environment (stage), the file will be named config.dev.json and may contain:

    "DB_URL": "mysql://username:password@localhost:3306/dbname"

Options on all commands:

Command Description
knex-cli --stage=[STAGE] Configures the current environment
knex-cli --config=[CONFIG_PATH] Path of the JSON config

Available commands:

Command Description
knex-cli migration:status Check migrations current status
knex-cli migration:run Run all pending migrations
knex-cli migration:rollback Rollback migration to latest batch or to a specific batch number
knex-cli migration:reset Rollback migration to the first batch
knex-cli seed Seed database using seed files
knex-cli make:migration [name] [tableName] Create a new migration file
knex-cli make:seed [name] Create a database seeder

Current Tags

  • 1.0.1                                ...           latest (2 years ago)

3 Versions

  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.9.0                                ...           2 years ago
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 3
Last Month 0
Dependencies (10)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2017 © taobao.org |