Skip to content

Commit

Permalink
docs: add migration in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse authored and fengmk2 committed Aug 13, 2018
1 parent 654fdf9 commit 0e59892
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports.sequelize = {
password: '',
// delegate: 'myModel', // load all models to `app[delegate]` and `ctx[delegate]`, default to `model`
// baseDir: 'my_model', // load all files in `app/${baseDir}` as models, default to `model`
// ignore: 'index.js', // ignore `app/${baseDir}/index.js` when load models
// ignore: 'index.js', // ignore `app/${baseDir}/index.js` when load models, support glob and array
};
```

Expand Down Expand Up @@ -106,15 +106,15 @@ module.exports = app => {
});

User.findByLogin = async (login) => {
return this.findOne({
return await this.findOne({
where: {
login: login
}
});
}

User.prototype.logSignin = async () => {
return this.update({ last_sign_in_at: new Date() });
return await this.update({ last_sign_in_at: new Date() });
}

return User;
Expand Down Expand Up @@ -177,7 +177,7 @@ By default, egg-sequelize will use sequelize@4, you can cusomize sequelize versi
```js
// config/config.default.js
exports.sequelize = {
sequelize: require('sequelize');
Sequelize: require('sequelize');
};
```

Expand Down Expand Up @@ -253,6 +253,10 @@ module.exports = app => {
};
```

## Migration

Using [sequelize-cli](https://github.com/sequelize/cli) to help manage your database, data structures and seed data. Please read [Sequelize - Migrations](http://docs.sequelizejs.com/manual/tutorial/migrations.html) to learn more infomations.

## Recommended example

- https://github.com/eggjs/examples/tree/master/sequelize-example/
Expand Down

0 comments on commit 0e59892

Please sign in to comment.