mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-09 01:17:06 +02:00
chore: do not destroy db on startup
This commit is contained in:
parent
c89638fda2
commit
59f89001e9
@ -7,9 +7,14 @@ const { createDb } = require('../../../lib/db/db-pool');
|
|||||||
|
|
||||||
const dbState = require('./database.json');
|
const dbState = require('./database.json');
|
||||||
|
|
||||||
|
// require('db-migrate-shared').log.silence(false);
|
||||||
|
|
||||||
// because of migrator bug
|
// because of migrator bug
|
||||||
delete process.env.DATABASE_URL;
|
delete process.env.DATABASE_URL;
|
||||||
|
|
||||||
|
// because of db-migrate bug (https://github.com/Unleash/unleash/issues/171)
|
||||||
|
process.setMaxListeners(0);
|
||||||
|
|
||||||
async function resetDatabase(stores) {
|
async function resetDatabase(stores) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
stores.db('strategies').del(),
|
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 db.raw(`CREATE SCHEMA IF NOT EXISTS ${options.databaseSchema}`);
|
||||||
await migrator(options);
|
await migrator(options);
|
||||||
await db.destroy();
|
|
||||||
const stores = await createStores(options, eventBus);
|
const stores = await createStores(options, eventBus);
|
||||||
await resetDatabase(stores);
|
await resetDatabase(stores);
|
||||||
await setupDatabase(stores);
|
await setupDatabase(stores);
|
||||||
|
Loading…
Reference in New Issue
Block a user