grunt-knex-migrate

0.0.2 • Public • Published

grunt-knex-migrate Build Status

Grunt task for knex's migrate

knexmigrate task

grunt-knex-migrate receives knex:migrate command to the first argument.

Commands

knexmigrate:make:[name]

Creates a new migration, specifying the name for the migration.

knexmigrate:latest

Runs migrations for the current config.

knexmigrate:rollback

Rolls back the last migration batch.

knexmigrate:currentVersion

The current version for the migrations.

Configuration

Migration configurations are specified in config field or by passing file name via command line --config option (always command line option precedes). This value could be literal Object, file name or custom function. Migration configurations are below:

database

knex initialize parameters

directory

relative directory from which the migrations should be read & written.

tableName

table name for the migrations

Usage Examples

Please see example directory.

Via Object

knexmigrate: {
  config: {
    directory: './db/migrate',
    tableName: 'knex_migrations',
    database: {
      client: 'sqlite3',
      connection: {
        filename: './db/simple.db'
      }
    }
  }
}

Via filename

knexmigrate: {
  config: './config.json'
}

Via function

knexmigrate: {
  config: function(cb) {
    // calcurate configration
    cb(null, config);
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i grunt-knex-migrate

Weekly Downloads

17

Version

0.0.2

License

MIT

Last publish

Collaborators

  • p-baleine