rake-db 2.8.20 → 2.8.22
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 +18 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -219,23 +219,25 @@ const getMigrationFiles = async (config, up) => {
|
|
|
219
219
|
return [];
|
|
220
220
|
}
|
|
221
221
|
const sort = up ? sortAsc : sortDesc;
|
|
222
|
-
return sort(files
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
222
|
+
return sort(files.filter((file) => path.basename(file).includes("."))).map(
|
|
223
|
+
(file) => {
|
|
224
|
+
if (!file.endsWith(".ts")) {
|
|
225
|
+
throw new Error(
|
|
226
|
+
`Only .ts files are supported for migration, received: ${file}`
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
const timestampMatch = file.match(/^(\d{14})\D/);
|
|
230
|
+
if (!timestampMatch) {
|
|
231
|
+
throw new Error(
|
|
232
|
+
`Migration file name should start with 14 digit version, received ${file}`
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
return {
|
|
236
|
+
path: path.resolve(migrationsPath, file),
|
|
237
|
+
version: timestampMatch[1]
|
|
238
|
+
};
|
|
233
239
|
}
|
|
234
|
-
|
|
235
|
-
path: path.resolve(migrationsPath, file),
|
|
236
|
-
version: timestampMatch[1]
|
|
237
|
-
};
|
|
238
|
-
});
|
|
240
|
+
);
|
|
239
241
|
};
|
|
240
242
|
const sortAsc = (arr) => arr.sort();
|
|
241
243
|
const sortDesc = (arr) => arr.sort((a, b) => a > b ? -1 : 1);
|