rake-db 2.10.66 → 2.10.68
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.
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -242,9 +242,7 @@ function getMigrationsFromConfig(config, up) {
|
|
|
242
242
|
load: migrations[key]
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
|
|
246
|
-
result.reverse();
|
|
247
|
-
return result;
|
|
245
|
+
return up ? result : result.reverse();
|
|
248
246
|
}
|
|
249
247
|
async function getMigrationsFromFiles(config, up) {
|
|
250
248
|
const { migrationsPath, import: imp } = config;
|
|
@@ -2318,8 +2316,13 @@ const processMigration = async (db, up, file, config, options, appCodeUpdaterCac
|
|
|
2318
2316
|
changeCache[file.path] = changes;
|
|
2319
2317
|
}
|
|
2320
2318
|
const db2 = createMigrationInterface(tx, up, config);
|
|
2321
|
-
|
|
2322
|
-
|
|
2319
|
+
if (changes.length) {
|
|
2320
|
+
const from = up ? 0 : changes.length - 1;
|
|
2321
|
+
const to = up ? changes.length : -1;
|
|
2322
|
+
const step = up ? 1 : -1;
|
|
2323
|
+
for (let i = from; i !== to; i += step) {
|
|
2324
|
+
await changes[i](db2, up);
|
|
2325
|
+
}
|
|
2323
2326
|
}
|
|
2324
2327
|
await (up ? saveMigratedVersion : removeMigratedVersion)(
|
|
2325
2328
|
db2.adapter,
|
|
@@ -2344,11 +2347,7 @@ const processMigration = async (db, up, file, config, options, appCodeUpdaterCac
|
|
|
2344
2347
|
const migrate = (options, config, args = []) => migrateOrRollback(options, config, args, true);
|
|
2345
2348
|
const rollback = (options, config, args = []) => migrateOrRollback(options, config, args, false);
|
|
2346
2349
|
const redo = async (options, config, args = []) => {
|
|
2347
|
-
var _a;
|
|
2348
2350
|
await migrateOrRollback(options, config, args, false);
|
|
2349
|
-
for (const file in changeCache) {
|
|
2350
|
-
(_a = changeCache[file]) == null ? void 0 : _a.reverse();
|
|
2351
|
-
}
|
|
2352
2351
|
await migrateOrRollback(options, config, args, true);
|
|
2353
2352
|
};
|
|
2354
2353
|
|