Sequelize schema design

Quick start guide for Sequelize schema design in Meteor Modeler.

  1. New project
  2. Sequelize models
  3. Associations
  4. Code generation
  5. Import from Luna Modeler

1. New project

To create a new project, click the New item on the toolbar and select the Sequelize project type.

2. Sequelize models

To add a new Sequelize model to your design, click the Model item on the toolbar and then click the main diagram area.

Sequelize schema design - new model

The new object appears in the diagram. You can edit Sequelize model properties via right-side panel:

Sequelize schema design - model details

If you prefer modal dialogs, double click an item on a diagram or open popup and choose Edit.

Model properties

In section Details, collection settings can be specified.

Fields

In section Fields, you can add new fields to collections to your Sequelize schema design. Specify new field name, data type, parameter and click Add.
REQ represents the required field.

Sequelize schema design - model properties

Field specifics

To access area where Sequelize field specifics can be modified, click the arrow left to the field name.

Field details

3. Sequelize associations

Associations are represented by links between Sequelize models. New associations can be created by clicking the HasOne or BelongsTo icons on the main toolbar.

Sequelize - new model

Each association can be configured as a one-way association as well as a bi-directional association.
If you wish to define association as Has One and Belongs To at the same time, draw just one line and define details on the Association properties modal form.

Sequelize - new model

Each type of association is graphically represented in the diagram by a slightly different line.

  • Has one/Has many – solid line.
  • Belongs to/Belongs to many – dashed line.
  • Both – dash-dotted line
Sequelize diagram - schema

4. Code generation

To preview the validation script for your MongoDB schema design, click the Script tab on collection detail.

To save scripts to files, click the Script icon on the toolbar and then click Save script.

generated sequelize scripts

5. Import from Luna Modeler

Creating a Sequelize schema from existing databases can be done thanks to the integration with Luna Modeler. The following steps describe how to load existing database structures and create a Sequelize project.

  1. Reverse engineer an existing database structure using Luna Modeler
  2. In Luna Modeler copy selected tables
  3. Run Meteor Modeler and create a new empty project
  4. Paste the selected object to your Sequelize project
  5. Objects will be converted to Sequelize automatically
Creation of Sequelize diagram from existing databases.

Enjoy your Sequelize schema design modeling! Thanks for reading!

Quick links

Download Buy Now!

Blog Categories
Blog by Platforms