modify README.md
This commit is contained in:
parent
84881a00e9
commit
cfb5501536
|
@ -18,7 +18,7 @@ Feel free to vote and comment on cards (tickets/issues), if you want to join tea
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var Schema = require('./jugglingdb').Schema;
|
var Schema = require('./jugglingdb').Schema;
|
||||||
var s = new Schema('redis');
|
var schema = new Schema('redis', {port: 6379}); //port number depends on your configuration
|
||||||
// define models
|
// define models
|
||||||
var Post = schema.define('Post', {
|
var Post = schema.define('Post', {
|
||||||
title: { type: String, length: 255 },
|
title: { type: String, length: 255 },
|
||||||
|
@ -48,7 +48,7 @@ Post.belongsTo(User, {as: 'author', foreignKey: 'userId'});
|
||||||
// post.author() -- sync getter when called without params
|
// post.author() -- sync getter when called without params
|
||||||
// post.author(user) -- setter when called with object
|
// post.author(user) -- setter when called with object
|
||||||
|
|
||||||
s.automigrate(); // required only for mysql NOTE: it will drop User and Post tables
|
schema.automigrate(); // required only for mysql NOTE: it will drop User and Post tables
|
||||||
|
|
||||||
// work with models:
|
// work with models:
|
||||||
var user = new User;
|
var user = new User;
|
||||||
|
|
Loading…
Reference in New Issue