Skip to content

Instantly share code, notes, and snippets.

@sibelius
Created October 14, 2019 14:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sibelius/91ebe975163b76ab32b3f0b2785a3803 to your computer and use it in GitHub Desktop.
Save sibelius/91ebe975163b76ab32b3f0b2785a3803 to your computer and use it in GitHub Desktop.
run migrations using require.context
export const runMigrations = async () => {
const req = require.context('./migrations', false, /.(t|j)s$/);
for (const filename of req.keys()) {
const migration = req(filename);
await migration.default(loggerMigration);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment