mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-02 15:16:38 +00:00
fix migration check
This commit is contained in:
@@ -494,7 +494,6 @@ func MigrateJsonToTable[T any](ctx context.Context, db *gorm.DB, columnName stri
|
||||
|
||||
func MigrateEmbeddedToTable[T any, S any, U any](ctx context.Context, db *gorm.DB, pkey string, mapperFunc func(obj S) *U) error {
|
||||
var model T
|
||||
var u U
|
||||
|
||||
log.WithContext(ctx).Debugf("Migrating embedded fields from %T to separate table", model)
|
||||
|
||||
@@ -502,10 +501,6 @@ func MigrateEmbeddedToTable[T any, S any, U any](ctx context.Context, db *gorm.D
|
||||
log.WithContext(ctx).Debugf("table for %T does not exist, no migration needed", model)
|
||||
return nil
|
||||
}
|
||||
if db.Migrator().HasTable(&u) {
|
||||
log.WithContext(ctx).Debugf("table for %T already exists, no migration needed", u)
|
||||
return nil
|
||||
}
|
||||
|
||||
stmt := &gorm.Statement{DB: db}
|
||||
err := stmt.Parse(&model)
|
||||
|
||||
Reference in New Issue
Block a user