mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
cmd: invalid field error
This commit is contained in:
@@ -347,17 +347,17 @@ func verifyOrphanedReferences(ctx context.Context, db *gorm.DB, sourceChecks []s
|
|||||||
}
|
}
|
||||||
|
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
// Get the specific warehouse IDs
|
// Get the specific warehouse IDs using raw SQL
|
||||||
var ids []uint
|
var ids []uint
|
||||||
if err := db.Table(ref.table).
|
query := fmt.Sprintf("SELECT DISTINCT %s FROM %s WHERE %s IN ?",
|
||||||
Where(fmt.Sprintf("%s IN ?", ref.column), warehouseIDs).
|
ref.column, ref.table, ref.column)
|
||||||
Pluck(ref.column, &ids).Error; err != nil {
|
if err := db.Raw(query, warehouseIDs).Scan(&ids).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
idStrs := make([]string, len(ids))
|
idStrs := make([]string, 0, len(ids))
|
||||||
for i, id := range ids {
|
for _, id := range ids {
|
||||||
idStrs[i] = fmt.Sprintf("%d", id)
|
idStrs = append(idStrs, fmt.Sprintf("%d", id))
|
||||||
}
|
}
|
||||||
|
|
||||||
results = append(results, orphanedReferenceCheck{
|
results = append(results, orphanedReferenceCheck{
|
||||||
|
|||||||
Reference in New Issue
Block a user