mirror of
https://github.com/stashapp/stash.git
synced 2025-12-15 12:52:38 +01:00
Delete scene/marker tag refs when deleting tags
This commit is contained in:
parent
e3687803c5
commit
45f72a549f
1 changed files with 13 additions and 0 deletions
|
|
@ -52,6 +52,19 @@ func (qb *TagQueryBuilder) Update(updatedTag Tag, tx *sqlx.Tx) (*Tag, error) {
|
|||
}
|
||||
|
||||
func (qb *TagQueryBuilder) Destroy(id string, tx *sqlx.Tx) error {
|
||||
// delete tag from scenes and markers first
|
||||
_, err := tx.Exec("DELETE FROM scenes_tags WHERE tag_id = ?", id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = tx.Exec("DELETE FROM scene_markers_tags WHERE tag_id = ?", id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// does not unset primary_tag_id in scene_markers because it is not nullable
|
||||
|
||||
return executeDeleteQuery("tags", id, tx)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue