mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix(migration): Unleash should not start if migration fails.
Closes #320
This commit is contained in:
		
							parent
							
								
									4d9a4405af
								
							
						
					
					
						commit
						28fd6f96f0
					
				@ -2,6 +2,7 @@
 | 
			
		||||
 | 
			
		||||
## Unreleased
 | 
			
		||||
- feat(bind): Added option to bind to specific http address
 | 
			
		||||
- fix(migration): Unleash should not start if migration fails.
 | 
			
		||||
 | 
			
		||||
## 3.0.2
 | 
			
		||||
- fix(package): Update unleash-frontend to version 3.0.1 
 | 
			
		||||
 | 
			
		||||
@ -38,12 +38,17 @@ function createApp(options) {
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function start(opts) {
 | 
			
		||||
async function start(opts) {
 | 
			
		||||
    const options = createOptions(opts);
 | 
			
		||||
 | 
			
		||||
    return migrator({ databaseUrl: options.databaseUrl })
 | 
			
		||||
        .catch(err => logger.error('failed to migrate db', err))
 | 
			
		||||
        .then(() => createApp(options));
 | 
			
		||||
    try {
 | 
			
		||||
        await migrator({ databaseUrl: options.databaseUrl });
 | 
			
		||||
    } catch (err) {
 | 
			
		||||
        logger.error('Failed to migrate db', err);
 | 
			
		||||
        throw err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return createApp(options);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user