Skip to content

Commit 4eb5fb2

Browse files
nucdaffl
authored andcommitted
Add migrations section in readme (#225)
1 parent 0b646d2 commit 4eb5fb2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,19 @@ app.service('messages').hooks({
303303
});
304304
```
305305

306+
## Configuring migrations
307+
308+
For using knex's migration CLI, we need to make the configuration available by the CLI. We can do that by providing a `knexfile.js` in the root folder with the following contents:
309+
310+
```js
311+
const app = require('./src/app')
312+
module.exports = app.get('mysql')
313+
```
314+
315+
You will need to replace the `mysql` part with the adapter you are using.
316+
317+
Then, by running: `npm run knex migrate:make create-users`, a `migrations` directory will be created, with the new migration.
318+
306319
### Error handling
307320

308321
As of version 4.0.0 `feathers-knex` only throws [Feathers Errors](https://docs.feathersjs.com/api/errors.html) with the message. On the server, the original error can be retrieved through a secure symbol via `error[require('feathers-knex').ERROR]`

0 commit comments

Comments
 (0)