Skip to content

Commit

Permalink
add logs to rollback
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Apr 29, 2022
1 parent ce215f2 commit 09c5335
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/rollback/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func (rm Manager) Rollback(ctx context.Context, db pg.DBI, network types.Network
}

func (rm Manager) rollbackTokenBalances(tx pg.DBI, level int64) error {
logger.Info().Msg("rollback token balances...")
transfers, err := rm.transfersRepo.GetAll(level)
if err != nil {
return err
Expand Down Expand Up @@ -145,6 +146,7 @@ func (rm Manager) rollbackAll(tx pg.DBI, level int64) error {
}

func (rm Manager) rollbackMigrations(tx pg.DBI, level int64) error {
logger.Info().Msg("rollback migrations...")
if _, err := tx.Model(new(migration.Migration)).
Where("contract_id IN (?)", tx.Model(new(contract.Contract)).Column("id").Where("level > ?", level)).
Where("level = ?", level).
Expand All @@ -155,6 +157,7 @@ func (rm Manager) rollbackMigrations(tx pg.DBI, level int64) error {
}

func (rm Manager) rollbackBigMapState(tx pg.DBI, level int64) error {
logger.Info().Msg("rollback big map states...")
states, err := rm.bmdRepo.StatesChangedAfter(level)
if err != nil {
return err
Expand Down Expand Up @@ -201,6 +204,7 @@ type lastAction struct {
}

func (rm Manager) rollbackOperations(tx pg.DBI, level int64) error {
logger.Info().Msg("rollback oeprations...")
var ops []operation.Operation
if err := tx.Model(&operation.Operation{}).
Where("level = ?", level).
Expand Down

0 comments on commit 09c5335

Please sign in to comment.