Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/p-baleine/grunt-knex-migrate
Grunt task for knex's migrate
https://github.com/p-baleine/grunt-knex-migrate
Last synced: 21 days ago
JSON representation
Grunt task for knex's migrate
- Host: GitHub
- URL: https://github.com/p-baleine/grunt-knex-migrate
- Owner: p-baleine
- Created: 2013-12-03T10:26:42.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-08-25T16:27:40.000Z (about 8 years ago)
- Last Synced: 2024-10-07T08:13:36.184Z (about 1 month ago)
- Language: JavaScript
- Size: 230 KB
- Stars: 10
- Watchers: 3
- Forks: 14
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# grunt-knex-migrate [![Build Status](https://travis-ci.org/p-baleine/grunt-knex-migrate.png?branch=master)](https://travis-ci.org/p-baleine/grunt-knex-migrate)
> Grunt task for [knex](http://knexjs.org/)'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](http://knexjs.org/#Initialize)
#### 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
```js
knexmigrate: {
config: {
directory: './db/migrate',
tableName: 'knex_migrations',
database: {
client: 'sqlite3',
connection: {
filename: './db/simple.db'
}
}
}
}
```#### Via filename
```js
knexmigrate: {
config: './config.json'
}
```#### Via function
```js
knexmigrate: {
config: function(cb) {
// calcurate configration
cb(null, config);
}
}
```