fix migration check

This commit is contained in:
Pascal Fischer
2025-07-04 15:23:03 +02:00
parent 3931958499
commit bcab5cbbee

View File

@@ -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)