master
Evan Chen 2021-12-26 15:42:57 +08:00
parent 5c8b5c20d6
commit 4cb2bad653
1 changed files with 4 additions and 2 deletions

View File

@ -44,9 +44,11 @@ func ChangeCalGroup(tx *gorm.DB, cal_id, to string) error {
if affected == 0 { if affected == 0 {
return errors.ErrorNotFound return errors.ErrorNotFound
} }
tx.Exec(`update events set group_id = ( tx.Exec(`update event_groups set group_id = (
select id from groups where name = ? select id from groups where name = ?
) where calendar_id = ?`, to, cal_id) ) where id in (
select event_group_id from events where calendar_id = ?
)`, to, cal_id)
return nil return nil
} }