Reputation: 8519
We are evaluating a migration from postgraphile to hasura and what I've noticed is that hasura doesn't support a contains
filter option for a view column of type integer[]
.
Is there a way to enable this? We have several views depending on the contains
filter.
We are using postgres12 and hasura 2.20.1
Upvotes: 1
Views: 355
Reputation: 721
You can do this by setting the column type in Hasura to JSONB... the integer array is a valid JSON type and then you can query it like this:
query MyQuery {
test_table(where: {int_json: {_contains: 2}}) {
int_json
}
}
and you will get a response like this:
{
"data": {
"test_table": [
{
"int_json": [
1,
2,
3,
4
]
}
]
}
}
Upvotes: 0