How to insert initial data using sequelize migrations/seeds?

You can use next:

const City = sequelize.define('city', {
  name: { type: Sequelize.STRING },
  order_: { type: Sequelize.INTEGER }
});
City.sync().then(() => {
  City.create({
    name: 'Neuquen',
    order_: 0
  });
  City.create({
    name: 'General Roca',
    order_: 1
  });
});

Or read about “migrations” at http://docs.sequelizejs.com/en/latest/docs/migrations/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)