Implementing sequelize ExpressJS

101 views Asked by At

I am implementing sequelizer in an sailsJS application (ExpressJs), I am following this tutorial: https://github.com/sequelize/express-example from the sequelize team that explain how to implement it. But I still getting an error, my only model by the moment is (The same of the repository):

module.exports = function(sequelize, DataTypes) {
  var User = sequelize.define("User", {
    username: DataTypes.STRING
  });

return User;
};

And here is where I'm trying to create a new object:

var models = require("../api/models");
  models.sequelize.sync({force: true}).then(function () {
  models.User.create({
    username: "MiguelCrespo"
  }).then(function() {
    console.log("THEN");
  });
});

And after trying that I get this error:

Error

But I can search in the models correctly, this error is only when I try to save or create a new object in the database

0

There are 0 answers