3.0.86 • Published 3 months ago

sequelizr v3.0.86

Weekly downloads
4
License
MIT
Repository
github
Last release
3 months 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.85

7 months ago

3.0.86

3 months ago

3.0.84

8 months ago

3.0.83

1 year ago

3.0.81

1 year ago

3.0.82

1 year ago

3.0.80

1 year ago

3.0.79

1 year ago

3.0.78

2 years ago

3.0.76

2 years ago

3.0.77

2 years ago

3.0.75

2 years ago

3.0.68

2 years ago

3.0.69

2 years ago

3.0.70

2 years ago

3.0.71

2 years ago

3.0.74

2 years ago

3.0.72

2 years ago

3.0.73

2 years ago

3.0.67

2 years ago

3.0.65

3 years ago

3.0.66

3 years ago

3.0.60

3 years ago

3.0.63

3 years ago

3.0.64

3 years ago

3.0.61

3 years ago

3.0.62

3 years ago

3.0.56

3 years ago

3.0.57

3 years ago

3.0.58

3 years ago

3.0.59

3 years ago

3.0.54

3 years ago

3.0.55

3 years ago

3.0.52

3 years ago

3.0.53

3 years ago

3.0.50

3 years ago

3.0.51

3 years ago

3.0.45

3 years ago

3.0.46

3 years ago

3.0.43

3 years ago

3.0.44

3 years ago

3.0.49

3 years ago

3.0.47

3 years ago

3.0.48

3 years ago

3.0.41

3 years ago

3.0.42

3 years ago

3.0.40

3 years ago

3.0.38

3 years ago

3.0.39

3 years ago

3.0.36

3 years ago

3.0.37

3 years ago

3.0.23

3 years ago

3.0.24

3 years ago

3.0.21

3 years ago

3.0.22

3 years ago

3.0.27

3 years ago

3.0.28

3 years ago

3.0.25

3 years ago

3.0.26

3 years ago

3.0.20

4 years ago

3.0.34

3 years ago

3.0.35

3 years ago

3.0.32

3 years ago

3.0.33

3 years ago

3.0.30

3 years ago

3.0.31

3 years ago

3.0.29

3 years ago

3.0.19

4 years ago

3.0.18

4 years ago

3.0.17

4 years ago

3.0.16

4 years ago

3.0.15

4 years ago

3.0.14

4 years ago

3.0.13

4 years ago

3.0.12

4 years ago

3.0.11

4 years ago

3.0.10

4 years ago

3.0.9

4 years ago

3.0.8

4 years ago

3.0.7

4 years ago

3.0.6

4 years ago

3.0.5

4 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.1.11

5 years ago

2.0.0

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago