Fixes path for migrations in production (#196)

This commit is contained in:
Chris Anderson 2023-06-21 21:40:05 -05:00 committed by GitHub
parent 87b052e117
commit 4ab6050831
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,7 +55,13 @@ const migrate = async (config: DatabaseConfig, db: Database, fresh = false) => {
// Run migrations
return db.migrate.latest({
directory: [path.resolve(__dirname, '../../db/migrations'), ...config.migrationPaths],
directory: [
path.resolve(__dirname, process.env.NODE_ENV === 'production'
? '../db/migrations'
: '../../db/migrations',
),
...config.migrationPaths,
],
tableName: 'migrations',
loadExtensions: ['.js', '.ts'],
})