Run migrations upfront (#4607)

This commit is contained in:
Chris Stewart 2022-08-15 10:29:38 -05:00 committed by GitHub
parent d0dadfa423
commit a0851fea58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()))