mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
72e9a34365
* Remove unused tables, soft rename, take 3 * Bump db schema version * nil check in migration
33 lines
726 B
Go
33 lines
726 B
Go
package migrations
|
|
|
|
import (
|
|
"github.com/ledgerwatch/erigon/common/dbutils"
|
|
"github.com/ledgerwatch/erigon/common/etl"
|
|
"github.com/ledgerwatch/erigon/ethdb"
|
|
)
|
|
|
|
var oldSequences = map[string]string{
|
|
dbutils.EthTx: "eth_tx",
|
|
}
|
|
|
|
var fixSequences = Migration{
|
|
Name: "fix_sequences",
|
|
Up: func(db ethdb.Database, tmpdir string, progress []byte, CommitProgress etl.LoadCommitHandler) (err error) {
|
|
for bkt, oldbkt := range oldSequences {
|
|
seq, getErr := db.GetOne(dbutils.Sequence, []byte(oldbkt))
|
|
if getErr != nil {
|
|
return getErr
|
|
}
|
|
|
|
if seq != nil {
|
|
putErr := db.Put(dbutils.Sequence, []byte(bkt), seq)
|
|
if putErr != nil {
|
|
return putErr
|
|
}
|
|
}
|
|
}
|
|
|
|
return CommitProgress(db, nil, true)
|
|
},
|
|
}
|