1.0.1 • Published 6 years ago

@elevenlabs/knex-cli v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

Knex Cli

Requirements

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:

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

Available commands:

CommandDescription
knex-cli migration:statusCheck migrations current status
knex-cli migration:runRun all pending migrations
knex-cli migration:rollbackRollback migration to latest batch or to a specific batch number
knex-cli migration:resetRollback migration to the first batch
knex-cli seedSeed database using seed files
knex-cli make:migration [name] [tableName]Create a new migration file
knex-cli make:seed [name]Create a database seeder
1.0.1

6 years ago

1.0.0

6 years ago

0.9.0

6 years ago