I want to create only one row using insert() in Sequelize migration. I have seen the examples for bulkInsert() but don't want to use bulk. We have this function to create only one row: insert(instance, tableName, values, options) But I don't understand what's the instance here in param? I am using bulkInsert because it does not ask for instance param. It will be great if you can add insert in my code written below. Migration lib: https://github.com/sequelize/sequelize/blob/master/lib/query-interface.js
//Code for insertion using bulkInsert
module.exports = {
up: (queryInterface) => {
queryInterface.describeTable('Platforms').then((attributes) => {
return queryInterface.bulkInsert('Platforms', [{
id: 6,
display_name: 'Booking.com',
code: 'booking.com',
}]);
});
},
down: (queryInterface) => {
return queryInterface.bulkDelete('Platforms', {
id: 6,
});
},
};
via Hassan Ajaz
No comments:
Post a Comment