grunt-knex-migrate

Grunt task for knex's migrate

grunt-knex-migrate

Grunt task for knex's migrate

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

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

Runs migrations for the current config.

Rolls back the last migration batch.

The current version for the migrations.

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:

knex initialize parameters

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

table name for the migrations

Please see example directory.

knexmigrate: {
  config: {
    directory: './db/migrate',
    tableName: 'knex_migrations',
    database: {
      client: 'sqlite3',
      connection: {
        filename: './db/simple.db'
      }
    }
  }
}
knexmigrate: {
  config: './config.json'
}
knexmigrate: {
  configfunction(cb) {
    // calcurate configration 
    cb(null, config);
  }
}