diff --git a/src/migrator.ts b/src/migrator.ts index e0de940..47d4a0a 100644 --- a/src/migrator.ts +++ b/src/migrator.ts @@ -362,8 +362,11 @@ class Migrator { }> { const files = fs.readdirSync(this.migrationsPath) const migrationsInDb = await this.migrationModel.find({}).exec() + + const fileExtensions = ['.ts', '.js'] + const migrationsInFs = files - .filter((filename) => /^\d{13,}-/.test(filename) && filename.endsWith('.ts')) + .filter((filename) => /^\d{13,}-/.test(filename) && fileExtensions.some((ext) => filename.endsWith(ext))) .map((filename) => { const [time] = filename.split('-') const timestamp = Number.parseInt(time ?? '')