Rebuild association tables, ensure file-system-based galleries cannot be changed (#2955)

* Re-create tables to include primary keys
* Filesystem-based galleries cannot change images
This commit is contained in:
WithoutPants
2022-09-30 09:18:58 +10:00
committed by GitHub
parent dce90a3ed9
commit ad7fbce5f7
16 changed files with 983 additions and 52 deletions

View File

@@ -1168,6 +1168,14 @@ func (qb *GalleryStore) GetImageIDs(ctx context.Context, galleryID int) ([]int,
return qb.imagesRepository().getIDs(ctx, galleryID)
}
func (qb *GalleryStore) AddImages(ctx context.Context, galleryID int, imageIDs ...int) error {
return qb.imagesRepository().insertOrIgnore(ctx, galleryID, imageIDs...)
}
func (qb *GalleryStore) RemoveImages(ctx context.Context, galleryID int, imageIDs ...int) error {
return qb.imagesRepository().destroyJoins(ctx, galleryID, imageIDs...)
}
func (qb *GalleryStore) UpdateImages(ctx context.Context, galleryID int, imageIDs []int) error {
// Delete the existing joins and then create new ones
return qb.imagesRepository().replace(ctx, galleryID, imageIDs)