Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion commands/run-migrations-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ module.exports = function (migrationProvider, adapter, minMigrationTime, logger)
function getPending(migrationsList, appliedMigrationIds, minMigrationTime) {
var pending = [];
migrationsList.forEach(function (migration) {
var id = migration.match(/^(\d+)/)[0];
var idMatch = migration.match(/^(\d+)/);
if (!idMatch) {
console.log(`Ignoring file ${migration}, it does not match the naming pattern.`);
return;
}
var id = idMatch[0];
if ((!minMigrationTime || id >= minMigrationTime) && !~appliedMigrationIds.indexOf(id) && migration.match(/^\d+\_up.*$/)) {
pending.push(migration);
}
Expand Down
3 changes: 2 additions & 1 deletion migration-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ var path = require('path');
module.exports = function (config) {
return {
getMigrationsList: function () {
return fs.readdirSync(config.migrationsDir);
return fs.readdirSync(config.migrationsDir)
.filter(filename => filename.endsWith('.sql'));
},
/**
* @param {Array} migrationsList list of filenames
Expand Down