Giter Site home page Giter Site logo

reverse-db's Introduction

Reverse Db

Automatically generate JSON models for Relational DBs (MSSQL, MariaDB, MySQL, Postgres, Sqlite) via the command line.

Install

npm install -g reverse-db

Prerequisites

You will need to install the correct dialect binding globally before using reverse-db.

Example for MySQL/MariaDB

npm install -g mysql

Example for Postgres

npm install -g pg pg-hstore

Example for Sqlite3

npm install -g sqlite

Example for MSSQL

npm install -g mssql

Usage

[node] reverse-db -h <host> -d <database> -u <user> -x [password] -p [port]  --dialect [dialect] -c [/path/to/config] -o [/path/to/models] -t [tableName] -C

Options:
  -h, --host        IP/Hostname for the database.   [required]
  -d, --database    Database name.                  [required]
  -u, --user        Username for database.
  -x, --pass        Password for database.
  -p, --port        Port number for database.
  -o, --output      What directory to place the models.
  -e, --dialect     The dialect/engine that you're using: postgres, mysql, sqlite

Example

reverse-db -o "./models" -d test -h localhost -u my_username -p 5432 -x my_password -e postgres

Produces a file/files such as ./models/SkillLevels.js which looks like:

/* jshint indent: 2 */

const SkillLevels = {
  'id': null,
  'name': null,
  'createdAt': null,
  'updatedAt': null
}

module.exports = Object.assign({}, SkillLevels);

Which makes it easy for you to simply import and use it.


This project was based on Sequelize-Auto

reverse-db's People

Contributors

agezao avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.