I'm trying to model a many-to-many relationship with containers containing items which can belong to multiple containers with the help of a container_items table defined like so:
CREATE TABLE container_items (
container_id UUID NOT NULL,
item_id UUID NOT NULL,
PRIMARY KEY (container_id, item_id)
);
But I get errors in the Generated/Types.hs file about Couldn't match type ‘Id' "items"’ with ‘UUID’ .
build/Generated/Types.hs:41:30: error:
• Couldn't match type ‘Id' "items"’ with ‘UUID’
arising from a use of ‘QueryBuilder.filterWhere’
• In the third argument of ‘Item’, namely
‘(QueryBuilder.filterWhere
(#itemId, id) (QueryBuilder.query @ContainerItem))’
In the second argument of ‘($)’, namely
‘Item
id
name
(QueryBuilder.filterWhere
(#itemId, id) (QueryBuilder.query @ContainerItem))
def’
In a stmt of a 'do' block:
pure
$ Item
id
name
(QueryBuilder.filterWhere
(#itemId, id) (QueryBuilder.query @ContainerItem))
def
|
41 | pure $ Item id name (QueryBuilder.filterWhere (#itemId, id) (QueryBuilder.query @ContainerItem)) def
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^build/Generated/Types.hs:41:30: error:
• Couldn't match type ‘Id' "items"’ with ‘UUID’
arising from a use of ‘QueryBuilder.filterWhere’
• In the third argument of ‘Item’, namely
‘(QueryBuilder.filterWhere
(#itemId, id) (QueryBuilder.query @ContainerItem))’
In the second argument of ‘($)’, namely
‘Item
id
name
(QueryBuilder.filterWhere
(#itemId, id) (QueryBuilder.query @ContainerItem))
def’
In a stmt of a 'do' block:
pure
$ Item
id
name
(QueryBuilder.filterWhere
(#itemId, id) (QueryBuilder.query @ContainerItem))
def
|
41 | pure $ Item id name (QueryBuilder.filterWhere (#itemId, id) (QueryBuilder.query @ContainerItem)) def
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I can get this to work if I have an id column as a pkey on container_items but should that be necessary? Not sure what I'm doing wrong here.
Did you use any special characters? I suspect it’s because the markdown couldn’t be parsed.
I created the following issue to cover the “Something went wrong” messages.
https://github.com/digitallyinduced/ihp-forum/issues/14
I cloned the forum app to test this locally. It seems to choke on snake case words for some reason. No special characters needed.
Turns out you need to escape underscores with a backslash in mmark or it won't parse the message. I edited the original message to render correctly.
I'm having problems using composite primary keys but something in my original message is causing the forum to say "Something went wrong" instead.