fix: handle migrations .js naming

This commit is contained in:
NGPixel 2020-01-26 21:04:38 -05:00
parent 4dc7e05373
commit 22fa5c9b23

View File

@ -13,14 +13,14 @@ module.exports = {
*/ */
async getMigrations() { async getMigrations() {
const migrationFiles = await fs.readdir(baseMigrationPath) const migrationFiles = await fs.readdir(baseMigrationPath)
return migrationFiles.sort(semver.compare).map(m => ({ return migrationFiles.map(m => m.replace('.js', '')).sort(semver.compare).map(m => ({
file: m, file: m,
directory: baseMigrationPath directory: baseMigrationPath
})) }))
}, },
getMigrationName(migration) { getMigrationName(migration) {
return migration.file return migration.file.indexOf('.js') >= 0 ? migration.file : `${migration.file}.js`
}, },
getMigration(migration) { getMigration(migration) {