mirror of
https://github.com/directus/directus.git
synced 2026-02-19 10:14:33 -05:00
Create allow list for custom migration file extensions (#4358)
This commit is contained in:
@@ -14,12 +14,13 @@ export default async function run(database: Knex, direction: 'up' | 'down' | 'la
|
||||
let migrationFiles = await fse.readdir(__dirname);
|
||||
|
||||
const customMigrationsPath = path.resolve(env.EXTENSIONS_PATH, 'migrations');
|
||||
const customMigrationFiles =
|
||||
let customMigrationFiles =
|
||||
((await fse.pathExists(customMigrationsPath)) && (await fse.readdir(customMigrationsPath))) || [];
|
||||
|
||||
migrationFiles = migrationFiles.filter(
|
||||
(file: string) => file.startsWith('run') === false && file.endsWith('.d.ts') === false
|
||||
);
|
||||
customMigrationFiles = customMigrationFiles.filter((file: string) => file.endsWith('.js'));
|
||||
|
||||
const completedMigrations = await database.select<Migration[]>('*').from('directus_migrations').orderBy('version');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user