Merge pull request #1982 from molecula/restore-migrate

Restore migrate
This commit is contained in:
tgruben 2022-03-16 15:19:26 -05:00 committed by GitHub
commit 11c55faeba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

26
hack.go
View file

@ -2,6 +2,7 @@
package pilosa
import (
"math"
"time"
"github.com/gogo/protobuf/proto"
@ -48,14 +49,6 @@ func UnmarshalFieldOptions(name string, createdAt int64, buf []byte) (*FieldInfo
}
fi.Options.CacheType = pbi.CacheType
fi.Options.CacheSize = pbi.CacheSize
fi.Options.Min = pql.Decimal{
Value: pbi.OldMin,
Scale: 3, //what scale?
}
fi.Options.Max = pql.Decimal{
Value: pbi.OldMax,
Scale: 3, //what scale? its 3
}
fi.Options.Base = pbi.Base
fi.Options.BitDepth = pbi.BitDepth
fi.Options.TimeQuantum = TimeQuantum(pbi.TimeQuantum)
@ -67,5 +60,22 @@ func UnmarshalFieldOptions(name string, createdAt int64, buf []byte) (*FieldInfo
fi.Options.Keys = pbi.Keys
fi.Options.NoStandardView = pbi.NoStandardView
// hard code for the unmarshal go broken with a version change
switch fi.Options.Type {
case "int":
min := int64(math.MinInt64)
max := int64(math.MaxInt64)
fi.Options.Min = pql.NewDecimal(min, 0)
fi.Options.Max = pql.NewDecimal(max, 0)
fi.Options.Base = 0
case "decimal":
scale := int64(3)
min, max := pql.MinMax(scale)
fi.Options.Min = min
fi.Options.Max = max
fi.Options.Base = 0
fi.Options.Scale = scale
}
return fi, nil
}