fix(history): support a migration history with entries without file extensions (.js is assumed in such case)

This commit is contained in:
Joakim Carlstein 2024-01-18 15:11:51 +01:00 committed by Joakim Carlstein
parent 114979f154
commit 73a8a42e5f
4 changed files with 67 additions and 2 deletions

View file

@ -23,7 +23,10 @@ export const getMigrations = async (cwd: string, directory: string): Promise<Mig
const allFilesInMigrationDirectory = await tryReadDirectory(directoryPath);
const migrationFiles: MigrationMetadata[] = allFilesInMigrationDirectory
.filter((file) => file.isFile() && !file.name.startsWith('.') && !file.name.startsWith('_'))
.filter(
(file) =>
file.isFile() && !file.name.startsWith('.') && !file.name.startsWith('_') && path.extname(file.name) !== '',
)
.sort((a, b) => a.name.localeCompare(b.name))
.map(({ name }) => {
const filePath = path.join(directoryPath, name);