1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-04 01:18:20 +02:00

chore: do not destroy db on startup

This commit is contained in:
ivaosthu 2019-10-02 22:48:12 +02:00
parent c89638fda2
commit 59f89001e9

View File

@ -7,9 +7,14 @@ const { createDb } = require('../../../lib/db/db-pool');
const dbState = require('./database.json');
// require('db-migrate-shared').log.silence(false);
// because of migrator bug
delete process.env.DATABASE_URL;
// because of db-migrate bug (https://github.com/Unleash/unleash/issues/171)
process.setMaxListeners(0);
async function resetDatabase(stores) {
return Promise.all([
stores.db('strategies').del(),
@ -59,7 +64,6 @@ module.exports = async function init(databaseSchema = 'test', getLogger) {
await db.raw(`CREATE SCHEMA IF NOT EXISTS ${options.databaseSchema}`);
await migrator(options);
await db.destroy();
const stores = await createStores(options, eventBus);
await resetDatabase(stores);
await setupDatabase(stores);