* Insert multiple records into a table * * @example * queryInterface.bulkInsert('roles', [{ * label: 'user', * createdAt: new Date(), * updatedAt: new Date() * }, { * label: 'admin', * createdAt: new Date(), * updatedAt: new Date() * }]); *
(tableName, records, options, attributes)
| 875 | * @returns {Promise} |
| 876 | */ |
| 877 | async bulkInsert(tableName, records, options, attributes) { |
| 878 | options = { ...options }; |
| 879 | options.type = QueryTypes.INSERT; |
| 880 | |
| 881 | const results = await this.sequelize.query( |
| 882 | this.queryGenerator.bulkInsertQuery(tableName, records, options, attributes), |
| 883 | options |
| 884 | ); |
| 885 | |
| 886 | return results[0]; |
| 887 | } |
| 888 | |
| 889 | async update(instance, tableName, values, identifier, options) { |
| 890 | options = { ...options }; |