knex-migrator 4.1.2 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +6 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -158,6 +158,7 @@ KnexMigrator.prototype.init = function init(options) {
158
158
  return database.createTransaction(self.connection, async function (transacting) {
159
159
  const existingMigrations = await transacting('migrations').select('name');
160
160
  const existingMigrationsNames = existingMigrations.map(m => m.name);
161
+ const migrationsToAdd = [];
161
162
 
162
163
  // CASE: Run over all migration scripts and add the file name to the database.
163
164
  for (const versionToMigrateTo of versionsToMigrateTo) {
@@ -170,13 +171,17 @@ KnexMigrator.prototype.init = function init(options) {
170
171
  continue;
171
172
  }
172
173
 
173
- await transacting('migrations').insert({
174
+ migrationsToAdd.push({
174
175
  name,
175
176
  version: versionToMigrateTo,
176
177
  currentVersion: self.currentVersion
177
178
  });
178
179
  }
179
180
  }
181
+
182
+ await self.connection
183
+ .batchInsert('migrations', migrationsToAdd)
184
+ .transacting(transacting);
180
185
  });
181
186
  })
182
187
  .then(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knex-migrator",
3
- "version": "4.1.2",
3
+ "version": "4.1.3",
4
4
  "description": "Database migrations with knex.",
5
5
  "keywords": [
6
6
  "ghost",