Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bifot/sequelize-models-generator
Util for generate sequelize models from pure MySQL tables.
https://github.com/bifot/sequelize-models-generator
Last synced: about 2 months ago
JSON representation
Util for generate sequelize models from pure MySQL tables.
- Host: GitHub
- URL: https://github.com/bifot/sequelize-models-generator
- Owner: bifot
- License: mit
- Created: 2018-06-18T13:37:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-18T13:40:59.000Z (over 6 years ago)
- Last Synced: 2024-10-14T09:32:42.564Z (2 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# sequelize-models-generator
Util for generate sequelize models from pure MySQL tables.
## Install
```sh
$ npm i sequelize-models-generator
```## Tests
```sh
$ npm test
```## Usage
```js
const generateModels = require('sequelize-models-generator')const { Users } = await generateModels({
host: process.env.DB_HOST,
db: process.env.DB_NAME,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD
}, [
{
tableName: 'game_users', // table name in db
newTableName: 'Users' // table name which return
}
])// call any sequelize methods as usually
// e.g.
await Users.create({})
await Users.findOne({})
await Users.findAll({})
```