3.0.83 • Published 25 days ago

sequelizr v3.0.83

Weekly downloads
4
License
MIT
Repository
github
Last release
25 days ago

sequelizr

Actions Status

Manage Sequelize models

Usage

CLI

You can use Sequelizr from the command line with the following commands:

Check models match database

Check if models match database tables.

sequelizr check [opts]

Command Options:
  --server, -s, --host       Server                       [string] [default: "localhost"]
  --database, -d             Database                                            [string]
  --tables, -t               Tables                                               [array]
  --username, --user, -u     User                                                [string]
  --password, -p             Password                                            [string]
  --port, -r                 Port                                                [number]
  --dialect, -l              Dialect                 [string] [choices: "mysql", "mssql"]
  --models, -m, --directory  Model Directory                      [string] [default: "."]
  --quiet, -q                Build Models Silently             [boolean] [default: false]
  --sort, -x                 Sort fields and attributes        [boolean] [default: false]
  --config, -c               Config File                                         [string]

Global Options:
  --help, -h  Show help                                                         [boolean]

Download models from database

Create model files from database tables.

sequelizr download [opts]

Command Options:
  --server, -s, --host       Server                       [string] [default: "localhost"]
  --database, -d             Database                                            [string]
  --tables, -t               Tables                                               [array]
  --username, --user, -u     User                                                [string]
  --password, -p             Password                                            [string]
  --port, -r                 Port                                                [number]
  --dialect, -l              Dialect                 [string] [choices: "mysql", "mssql"]
  --models, -m, --directory  Model Directory                      [string] [default: "."]
  --overwrite, -o            Overwrite files if they exist     [boolean] [default: false]
  --quiet, -q                Build Models Silently             [boolean] [default: false]
  --sort, -x                 Sort fields and attributes        [boolean] [default: false]
  --config, -c               Config File                                         [string]

Global Options:
  --help, -h  Show help                                                         [boolean]

Upload models to database

Create database tables from model files.

sequelizr upload [opts]

Command Options:
  --server, -s, --host       Server                       [string] [default: "localhost"]
  --database, -d             Database                                            [string]
  --tables, -t               Tables                                               [array]
  --username, --user, -u     User                                                [string]
  --password, -p             Password                                            [string]
  --port, -r                 Port                                                [number]
  --dialect, -l              Dialect                 [string] [choices: "mysql", "mssql"]
  --models, -m, --directory  Model Directory                      [string] [default: "."]
  --overwrite, -o            Drop tables before creating them  [boolean] [default: false]
  --alter, -a                Alters tables to fit models       [boolean] [default: false]
  --quiet, -q                Build Models Silently             [boolean] [default: false]
  --sort, -x                 Sort fields and attributes        [boolean] [default: false]
  --config, -c               Config File                                         [string]

Global Options:
  --help, -h  Show help                                                         [boolean]

API

You can also use Sequelizr programmatically.

const {checkModels, downloadModels, uploadModels} = require("sequelizr");
const config = require("./config");

checkModels(config);
downloadModels(config);
uploadModels(config);

Configuration

You can use a config file instead of cli arguments. The file can be a JSON or JavaScript file that exports an object.

Example config:

// config.js
module.exports = {
  database: "database",
  username: "username",
  password: "password",
  host: "host",
  port: 1433,
  dialect: "mssql",
  directory: "C:\\models\\database",
  tables: ["table1", "table2"],
  dialectOptions: {...},
  quiet: false, // Build tables silently. Don't output percent complete.
  sort: false, // sort fields and attributes to be more deterministic.

  // `check` specific options
  includeViews: true, // Check models for views along with tables. Default = true
  output: true,       // TRUE(default) = Output errors to console
                      // FALSE = Reject error string
                      // EventEmitter = emit "error" for each error

  // `download` specific options
  overwrite: false,   // Overwrite model files. Default = false
  includeViews: true, // Download models for views along with tables. Default = true

  // `upload` specific options
  overwrite: false,   // Drop tables before create. Default = false
  alter: false,       // Alters tables to fit models. Default = false
}
3.0.83

25 days ago

3.0.81

1 month ago

3.0.82

1 month ago

3.0.80

3 months ago

3.0.79

3 months ago

3.0.78

5 months ago

3.0.76

6 months ago

3.0.77

6 months ago

3.0.75

10 months ago

3.0.68

1 year ago

3.0.69

1 year ago

3.0.70

1 year ago

3.0.71

1 year ago

3.0.74

1 year ago

3.0.72

1 year ago

3.0.73

1 year ago

3.0.67

1 year ago

3.0.65

1 year ago

3.0.66

1 year ago

3.0.60

2 years ago

3.0.63

2 years ago

3.0.64

1 year ago

3.0.61

2 years ago

3.0.62

2 years ago

3.0.56

2 years ago

3.0.57

2 years ago

3.0.58

2 years ago

3.0.59

2 years ago

3.0.54

2 years ago

3.0.55

2 years ago

3.0.52

2 years ago

3.0.53

2 years ago

3.0.50

2 years ago

3.0.51

2 years ago

3.0.45

2 years ago

3.0.46

2 years ago

3.0.43

2 years ago

3.0.44

2 years ago

3.0.49

2 years ago

3.0.47

2 years ago

3.0.48

2 years ago

3.0.41

2 years ago

3.0.42

2 years ago

3.0.40

2 years ago

3.0.38

2 years ago

3.0.39

2 years ago

3.0.36

2 years ago

3.0.37

2 years ago

3.0.23

2 years ago

3.0.24

2 years ago

3.0.21

2 years ago

3.0.22

2 years ago

3.0.27

2 years ago

3.0.28

2 years ago

3.0.25

2 years ago

3.0.26

2 years ago

3.0.20

2 years ago

3.0.34

2 years ago

3.0.35

2 years ago

3.0.32

2 years ago

3.0.33

2 years ago

3.0.30

2 years ago

3.0.31

2 years ago

3.0.29

2 years ago

3.0.19

2 years ago

3.0.18

3 years ago

3.0.17

3 years ago

3.0.16

3 years ago

3.0.15

3 years ago

3.0.14

3 years ago

3.0.13

3 years ago

3.0.12

3 years ago

3.0.11

3 years ago

3.0.10

3 years ago

3.0.9

3 years ago

3.0.8

3 years ago

3.0.7

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

1.1.11

4 years ago

2.0.0

4 years ago

1.1.10

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago