|
@@ -24,7 +24,7 @@ const (
|
24
|
24
|
// 'version' of the database schema
|
25
|
25
|
keySchemaVersion = "db.version"
|
26
|
26
|
// latest schema of the db
|
27
|
|
- latestDbSchema = "14"
|
|
27
|
+ latestDbSchema = "15"
|
28
|
28
|
|
29
|
29
|
keyCloakSecret = "crypto.cloak_secret"
|
30
|
30
|
)
|
|
@@ -792,6 +792,26 @@ func schemaChangeV13ToV14(config *Config, tx *buntdb.Tx) error {
|
792
|
792
|
return nil
|
793
|
793
|
}
|
794
|
794
|
|
|
795
|
+// #1327: delete any invalid klines
|
|
796
|
+func schemaChangeV14ToV15(config *Config, tx *buntdb.Tx) error {
|
|
797
|
+ prefix := "bans.klinev2 "
|
|
798
|
+ var keys []string
|
|
799
|
+ tx.AscendGreaterOrEqual("", prefix, func(key, value string) bool {
|
|
800
|
+ if !strings.HasPrefix(key, prefix) {
|
|
801
|
+ return false
|
|
802
|
+ }
|
|
803
|
+ if key != strings.TrimSpace(key) {
|
|
804
|
+ keys = append(keys, key)
|
|
805
|
+ }
|
|
806
|
+ return true
|
|
807
|
+ })
|
|
808
|
+ // don't bother trying to fix these up
|
|
809
|
+ for _, key := range keys {
|
|
810
|
+ tx.Delete(key)
|
|
811
|
+ }
|
|
812
|
+ return nil
|
|
813
|
+}
|
|
814
|
+
|
795
|
815
|
func init() {
|
796
|
816
|
allChanges := []SchemaChange{
|
797
|
817
|
{
|
|
@@ -859,6 +879,11 @@ func init() {
|
859
|
879
|
TargetVersion: "14",
|
860
|
880
|
Changer: schemaChangeV13ToV14,
|
861
|
881
|
},
|
|
882
|
+ {
|
|
883
|
+ InitialVersion: "14",
|
|
884
|
+ TargetVersion: "15",
|
|
885
|
+ Changer: schemaChangeV14ToV15,
|
|
886
|
+ },
|
862
|
887
|
}
|
863
|
888
|
|
864
|
889
|
// build the index
|