2

Can I make an update query with join in Haskell? Maybe something like this:

putPromotionInStoreItemsFromStoreBySItemId :: SItemId -> SItemPromoId -> YesodDB App ()
putPromotionInStoreItemsFromStoreBySItemId siId pId = update $ \(si `InnerJoin` s `InnerJoin` ssi) -> do
  on $ ssi ^. SItemStore ==. s ^. StoreId
  on $ s ^. StoreId ==. si ^. SItemStore
  set ssi [ SItemPromotion =. val pId ]
  where_ $     si ^. SItemId ==. val siId 
           &&. isNothing (ssi ^. SItemDisabled)
FtheBuilder
  • 1,410
  • 12
  • 19

0 Answers0