From a0851fea588387c34c47385b467d6dc249b80a5b Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Mon, 15 Aug 2022 10:29:38 -0500 Subject: [PATCH] Run migrations upfront (#4607) --- .../main/scala/org/bitcoins/server/BitcoinSAppConfig.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/server/src/main/scala/org/bitcoins/server/BitcoinSAppConfig.scala b/app/server/src/main/scala/org/bitcoins/server/BitcoinSAppConfig.scala index 6e6db8f282..ce6553fbec 100644 --- a/app/server/src/main/scala/org/bitcoins/server/BitcoinSAppConfig.scala +++ b/app/server/src/main/scala/org/bitcoins/server/BitcoinSAppConfig.scala @@ -8,6 +8,7 @@ import org.bitcoins.commons.config.{AppConfig, ConfigOps} import org.bitcoins.commons.util.ServerArgParser import org.bitcoins.core.config.NetworkParameters import org.bitcoins.core.util.{StartStopAsync, TimeUtil} +import org.bitcoins.db.DbManagement import org.bitcoins.dlc.node.config.DLCNodeAppConfig import org.bitcoins.dlc.wallet.DLCAppConfig import org.bitcoins.keymanager.config.KeyManagerAppConfig @@ -80,6 +81,12 @@ case class BitcoinSAppConfig( val torDependentConfigs = Vector(nodeConf, bitcoindRpcConf, dlcConf, dlcNodeConf) + val dbConfigs: Vector[DbManagement] = + Vector(chainConf, walletConf, nodeConf, dlcConf) + + //run all migrations here to avoid issues like: https://github.com/bitcoin-s/bitcoin-s/issues/4606 + val _ = dbConfigs.map(_.migrate()) + val startedTorDependentConfigsF = for { _ <- torConfig _ <- Future.sequence(torDependentConfigs.map(_.start()))