func initCoreDb(app *App) { repo, err := db2.Open(app.config.StellarCoreDatabaseURL) if err != nil { log.Panic(err) } repo.DB.SetMaxIdleConns(4) repo.DB.SetMaxOpenConns(12) app.coreQ = &core.Q{repo} }
func initHorizonDb(app *App) { repo, err := db2.Open(app.config.DatabaseURL) if err != nil { log.Panic(err) } repo.DB.SetMaxIdleConns(4) repo.DB.SetMaxOpenConns(12) app.historyQ = &history.Q{repo} }
"github.com/stellar/horizon/db2/schema" "github.com/stellar/horizon/ingest" hlog "github.com/stellar/horizon/log" ) var dbCmd = &cobra.Command{ Use: "db [command]", Short: "commands to manage horizon's postgres db", } var dbInitCmd = &cobra.Command{ Use: "init", Short: "install schema", Long: "init initializes the postgres database used by horizon.", Run: func(cmd *cobra.Command, args []string) { db, err := db2.Open(viper.GetString("db-url")) if err != nil { hlog.Error(err) os.Exit(1) } err = schema.Init(db) if err != nil { hlog.Error(err) os.Exit(1) } }, } var dbMigrateCmd = &cobra.Command{ Use: "migrate [up|down|redo] [COUNT]",