From bf86bee6907392d8b9781dc5b5abb3d63bfb82cb Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 8 Apr 2026 10:25:47 +0200 Subject: [PATCH] feat(models): add ClearProjectBackground for scoped column update --- pkg/models/project.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/models/project.go b/pkg/models/project.go index 5d075780e..2f5b95625 100644 --- a/pkg/models/project.go +++ b/pkg/models/project.go @@ -1354,6 +1354,15 @@ func SetProjectBackground(s *xorm.Session, projectID int64, background *files.Fi return } +// ClearProjectBackground clears the background fields for a project without touching other columns. +func ClearProjectBackground(s *xorm.Session, projectID int64) (err error) { + _, err = s. + Where("id = ?", projectID). + Cols("background_file_id", "background_blur_hash"). + Update(&Project{}) + return +} + // setArchiveStateForProjectDescendants uses a recursive CTE to find and set the archived status of all descendant projects. func setArchiveStateForProjectDescendants(s *xorm.Session, parentProjectID int64, shouldBeArchived bool) error { var descendantIDs []int64