Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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({})
```