mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-25 05:49:06 +01:00
Refactor
This commit is contained in:
@@ -103,7 +103,6 @@ func MigrateFieldFromGobToJSON[T any, S any](db *gorm.DB, fieldName string) erro
|
|||||||
|
|
||||||
// MigrateNetIPFieldFromBlobToJSON migrates a Net IP column from Blob encoding to JSON encoding.
|
// MigrateNetIPFieldFromBlobToJSON migrates a Net IP column from Blob encoding to JSON encoding.
|
||||||
// T is the type of the model that contains the field to be migrated.
|
// T is the type of the model that contains the field to be migrated.
|
||||||
// S is the type of the field to be migrated.
|
|
||||||
func MigrateNetIPFieldFromBlobToJSON[T any](db *gorm.DB, fieldName string, indexName string) error {
|
func MigrateNetIPFieldFromBlobToJSON[T any](db *gorm.DB, fieldName string, indexName string) error {
|
||||||
oldColumnName := fieldName
|
oldColumnName := fieldName
|
||||||
newColumnName := fieldName + "_tmp"
|
newColumnName := fieldName + "_tmp"
|
||||||
@@ -130,9 +129,6 @@ func MigrateNetIPFieldFromBlobToJSON[T any](db *gorm.DB, fieldName string, index
|
|||||||
}
|
}
|
||||||
return fmt.Errorf("fetch first record: %w", err)
|
return fmt.Errorf("fetch first record: %w", err)
|
||||||
}
|
}
|
||||||
if len(item) < 0 {
|
|
||||||
return fmt.Errorf("no records fetched")
|
|
||||||
}
|
|
||||||
|
|
||||||
var js json.RawMessage
|
var js json.RawMessage
|
||||||
var syntaxError *json.SyntaxError
|
var syntaxError *json.SyntaxError
|
||||||
|
|||||||
Reference in New Issue
Block a user