Sequelize | The Node.js ORMSequelize

Sequelize is a promise-based ORM for Node.js and io.js. It supports the dialects PostgreSQL, MySQL,MariaDB, SQLite and MSSQL and features solid transaction support, relations, read replication andmore.

Installation

Example usage

  1. var Sequelize = require('sequelize');
  2. var sequelize = new Sequelize('database', 'username', 'password');
  3. var User = sequelize.define('user', {
  4. username: Sequelize.STRING,
  5. birthday: Sequelize.DATE
  6. });
  7. sequelize.sync().then(function() {
  8. return User.create({
  9. username: 'janedoe',
  10. birthday: new Date(1980, 6, 20)
  11. });
  12. }).then(function(jane) {
  13. console.log(jane.get({
  14. plain: true
  15. }));
  16. });