Skip to content

Commit

Permalink
Made deleteRecord a bit more generic to support records where relatio…
Browse files Browse the repository at this point in the history
…ns have been fetched

Currently deleteRecord is not working with records to which fetchRelated has been applied
  • Loading branch information
mpscholten committed Aug 19, 2020
1 parent a81a475 commit d0b8199
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion IHP/ModelSupport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ tableName = Text.pack (symbolVal @(GetTableName model) Proxy)
-- DELETE FROM projects WHERE id = '..'
--
-- Use 'deleteRecords' if you want to delete multiple records.
deleteRecord :: forall model id. (?modelContext :: ModelContext, Show id, KnownSymbol (GetTableName model), HasField "id" model id, model ~ GetModelById id, ToField id) => model -> IO ()
deleteRecord :: forall model id. (?modelContext :: ModelContext, Show id, KnownSymbol (GetTableName model), HasField "id" model id, ToField id) => model -> IO ()
deleteRecord model = do
let (ModelContext conn) = ?modelContext
let id = getField @"id" model
Expand Down

0 comments on commit d0b8199

Please sign in to comment.