w-auto-sequelize

1.0.27 • Public • Published

w-auto-sequelize

A wrapper for sequelize-auto.

Fork from: sequelize-auto

language npm version license gzip file size npm download npm download jsdelivr download

Documentation

To view documentation or get support, visit docs.

Installation

Using npm(ES6 module):

Note: w-auto-sequelize is mainly dependent on sequelize, async, eslint, fs and path

npm i w-auto-sequelize

Example for generate:

Link: [dev source code]

import was from 'w-auto-sequelize'

//opt
let opt = {
    database: 'worm',
    username: 'username',
    password: 'password',
    dialect: 'mssql',
    directory: './models',
    host: 'localhost',
    port: 1433,
}

was(opt)
    .then((res) => {
        console.log(JSON.stringify(res, null, 4))
    })
    .catch((err) => {
        console.log(err)
    })

// then => {
//     "tables": {
//         "users": {
//             "id": {
//                 "type": "VARCHAR(50)",
//                 "allowNull": false,
//                 "defaultValue": null,
//                 "primaryKey": true,
//                 "autoIncrement": false,
//                 "comment": null,
//                 "foreignKey": {
//                     "source_table": "users",
//                     "constraint_name": "PK_users",
//                     "source_column": "id",
//                     "target_table": null,
//                     "target_column": null,
//                     "constraint_type": "PRIMARY KEY",
//                     "is_identity": false,
//                     "isPrimaryKey": true
//                 }
//             },
//             "name": {
//                 "type": "NVARCHAR(50)",
//                 "allowNull": true,
//                 "defaultValue": null,
//                 "primaryKey": false,
//                 "autoIncrement": false,
//                 "comment": null
//             },
//             "value": {
//                 "type": "FLOAT",
//                 "allowNull": true,
//                 "defaultValue": null,
//                 "primaryKey": false,
//                 "autoIncrement": false,
//                 "comment": null
//             }
//         }
//     },
//     "foreignKeys": {
//         "users": {
//             "id": {
//                 "source_table": "users",
//                 "constraint_name": "PK_users",
//                 "source_column": "id",
//                 "target_table": null,
//                 "target_column": null,
//                 "constraint_type": "PRIMARY KEY",
//                 "is_identity": false,
//                 "isPrimaryKey": true
//             }
//         }
//     }
// }

Package Sidebar

Install

npm i w-auto-sequelize

Weekly Downloads

7

Version

1.0.27

License

MIT

Unpacked Size

1.54 MB

Total Files

58

Last publish

Collaborators

  • semisphere