github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/internal/peer/node/upgrade_dbs.go (about) 1 /* 2 Copyright hechain. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package node 8 9 import ( 10 "github.com/hechain20/hechain/core/ledger/kvledger" 11 "github.com/spf13/cobra" 12 ) 13 14 func upgradeDBsCmd() *cobra.Command { 15 return nodeUpgradeDBsCmd 16 } 17 18 var nodeUpgradeDBsCmd = &cobra.Command{ 19 Use: "upgrade-dbs", 20 Short: "Upgrades databases.", 21 Long: "Upgrades databases by directly updating the database format or dropping the databases." + 22 " Dropped databases will be rebuilt with new format upon peer restart. When the command is executed, the peer must be offline.", 23 RunE: func(cmd *cobra.Command, args []string) error { 24 config := ledgerConfig() 25 return kvledger.UpgradeDBs(config) 26 }, 27 }