* 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)
| 852 | * @returns {Promise} |
| 853 | */ |
| 854 | async bulkInsert(tableName, records, options, attributes) { |
| 855 | options = { ...options }; |
| 856 | options.type = QueryTypes.INSERT; |
| 857 | |
| 858 | const results = await this.sequelize.query( |
| 859 | this.queryGenerator.bulkInsertQuery(tableName, records, options, attributes), |
| 860 | options |
| 861 | ); |
| 862 | |
| 863 | return results[0]; |
| 864 | } |
| 865 | |
| 866 | async update(instance, tableName, values, identifier, options) { |
| 867 | options = { ...options }; |