1.0.9 • Published 7 years ago

models-generator v1.0.9

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

Models-Generator

A cli tool for generating sequelize models from a mysql database with the following code format:

import Sequelize from 'sequelize'
import {db} from '../../sequelize_connection.js'
db.define('aaatest', {
    field_1: {
        type:  Sequelize.INTEGER(11),
        allowNull: false,
        primaryKey: true,
        autoIncrement: true,
        ...
    },
    ...
})
const tablenameModel = db.models.tablename;
export {tablenameModel};
  • db : A sequelize instance containing the mysql database credentials for your project
  • tablename : Table name from your mysql database

Installing

Must have installed mysql globally

$ npm install -g models-generator

Usage

Go to your project's root working directory. Write in the terminal the following command.

$ generate -o FOLDER_NAME -d DB_NAME -h HOST -u USERNAME -p PORT -x PASS

Future Plans

  • Add output formatter, contrary to the current default format
  • Ability to choose a single file for generating
1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago