Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/boiawang/sequelize-db-export-import

Generater models from mysql db or import tables from models files
https://github.com/boiawang/sequelize-db-export-import

coffeescript mysql node sequelize

Last synced: about 1 month ago
JSON representation

Generater models from mysql db or import tables from models files

Awesome Lists containing this project

README

        

# Sequelize-DB-Export-Import

[![Build Status][travis-image]][travis-url]

Generate models files from db or generate tables from models.

Only mysql

![cmd](https://raw.githubusercontent.com/boiawang/sequelize-db-export-import/master/assets/resource-1.png)


![preview](https://raw.githubusercontent.com/boiawang/sequelize-db-export-import/master/assets/resource-2.png)

## Install

```
npm install -g sequelize-db-export-import
```

## Usage

```
seq-ei Create models by database or Create tables by models

-h, --help output usage information
-V, --version output the version number
-r, --reverse is generate model files or generate tables
-H, --host host ip default: 127.0.0.1
-u, --user host user default: root
-p, --password host password. default: ""
-d, --database database name
-o, --output select models dir
-m, --dialect db type
-P, --port db port. default: 3306
-e, --compile model file type
-c, --config config file
-C, --camel convert tableName and file to camelCase
-s, --space you can select 2 space or 4 space
--no-default-value exclude default data values
```

### Export models from db

```
seq-ei -H 192.168.1.220 -u root -p 123 -d test -o ./models -m mysql -P 3306 -e coffee -s 2
```

### Import tables from model files

```
seq-ei -r -H 192.168.1.220 -u root -p 123 -d test -o ./models -m mysql -P 3306 -e coffee -s 2
```

### Also use config file

config.json
```
{
"user": "root",
"password": "",
"host": "127.0.0.1",
"database": "test",
"dir": "./models",
"port": 3306,
"compile": "coffee",
"logging": false,
"space": 2,
"reverse": false
}
```

```
seq-ei -c config.json
```

## Test

```
# test all
make test

# test coverage
make test-cov

# test watch
make test-watch
```

### Todo

* postgres
* add cmd color
* add table output

## License

The MIT License

[travis-image]: https://travis-ci.org/boiawang/sequelize-db-export-import.svg
[travis-url]: https://travis-ci.org/boiawang/sequelize-db-export-import
[coveralls-image]: https://img.shields.io/coveralls/boiawang/sequelize-db-export-import.svg?style=flat
[coveralls-url]: https://coveralls.io/r/boiawang/sequelize-db-export-import?branch=master