[Files Refactor] Set primary flag when cleaning (#2880)

* Ensure single primary per object
* Set primary file during clean
* Only show migration notes for actual migrations
This commit is contained in:
WithoutPants
2022-09-05 11:46:18 +10:00
parent 7159ab69a3
commit 6b0bcdea88
12 changed files with 117 additions and 21 deletions

View File

@@ -246,6 +246,12 @@ func (qb *GalleryStore) UpdatePartial(ctx context.Context, id int, partial model
}
}
if partial.PrimaryFileID != nil {
if err := galleriesFilesTableMgr.setPrimary(ctx, id, *partial.PrimaryFileID); err != nil {
return nil, err
}
}
return qb.Find(ctx, id)
}