|
|
@ -81,6 +81,42 @@ var friendsWhoUseGmailQuery = userToFriends.where(friends.email.like('%@gmail.co |
|
|
|
|
|
|
|
There are a __lot__ more examples included in the `test/dialects` folder. |
|
|
|
|
|
|
|
## from the command line |
|
|
|
You can use the [sql-generate module](https://github.com/tmont/node-sql-generate) |
|
|
|
to automatically generate definition files from a database instance. For example, |
|
|
|
running `node-sql-generate --dsn "mysql://user:password@host/database"` will generate |
|
|
|
something similar to: |
|
|
|
|
|
|
|
```javascript |
|
|
|
// autogenerated by node-sql-generate v0.0.1 on Tue May 21 2013 01:04:12 GMT-0700 (PDT) |
|
|
|
var sql = require('sql'); |
|
|
|
|
|
|
|
/** |
|
|
|
* SQL definition for database.bar |
|
|
|
*/ |
|
|
|
exports.bar = sql.define({ |
|
|
|
name: 'bar', |
|
|
|
columns: [ |
|
|
|
'id', |
|
|
|
'foo_id' |
|
|
|
] |
|
|
|
}); |
|
|
|
|
|
|
|
/** |
|
|
|
* SQL definition for database.foo |
|
|
|
*/ |
|
|
|
exports.foo = sql.define({ |
|
|
|
name: 'foo', |
|
|
|
columns: [ |
|
|
|
'id', |
|
|
|
'field_1', |
|
|
|
'foo_bar_baz' |
|
|
|
] |
|
|
|
}); |
|
|
|
``` |
|
|
|
|
|
|
|
Read the module's documentation for more details. |
|
|
|
|
|
|
|
## contributing |
|
|
|
|
|
|
|
I __love__ contributions. If I could, I would write __love__ 500 times, but that would be readme bloat. |
|
|
|