Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.55 KB

README.md

File metadata and controls

48 lines (34 loc) · 1.55 KB

Sequelize tips and tricks

Introduction

The purpose of this guide is to provide guidance on building applications using Sequelize by showing tips and tricks about it. All examples were made using AdventureWorks database.

Official documentation! Complementary documentation!

Table of Content

  1. Setup
  2. Structure
  3. Mappings and Configurations
  4. Migrations
  5. Queries
  6. Write Operations
  7. Tests

Setup

You can enable/disable or customize sequelize logs using property logging in the sequelize configuration:

const sequelize = new Sequelize('AdventureWorks2016CTP3', 'my-user', 'my-password', {
  ...
  logging: false // or true or console.log (or another log app)
  ... 
});
  • Fixing de "sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security" message.

To fix this message you need to set the operatorsAliases in the sequelize configuration properties with false or Sequelize.Op:

const sequelize = new Sequelize('AdventureWorks2016CTP3', 'my-user', 'my-password', {
  ...
  operatorsAliases: false, // Sequelize.Op
  ... 
});

See more at: http://docs.sequelizejs.com/manual/tutorial/querying.html#operators