Created
October 14, 2019 14:21
-
-
Save sibelius/91ebe975163b76ab32b3f0b2785a3803 to your computer and use it in GitHub Desktop.
run migrations using require.context
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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