We're experiencing a weird problem in Hasura. We added a unique key in our postgres DB (via rails) and we can see it's there when we do a query in Hasura
SELECT tablename, indexname, indexdef
FROM pg_indexes
WHERE tablename = 'customers';
customers customers_pkey CREATE UNIQUE INDEX customers_pkey ON public.customers USING btree (id)
customers customers_merchant_id_email_key CREATE UNIQUE INDEX customers_merchant_id_email_key ON public.customers USING btree (merchant_id, email)
but when we view the table it displays nothing and displays
**Unique Keys**
[Add] No unique keys
and even if adding it (by clicking [Add] button) it says it exists
**Saving unique key failed**
postgres-error : relation "customers_merchant_id_email_key" already exists
Also, upon doing an "upsert" on the table using the constraint, it says it does not exist.
mutation MyMutation {
insert_customers(
objects: {
email: "asdf@gmail.com",
merchant_id: "5792121d-4423-4a1e-8612-7fc090f2e71a",
first_name: "Foobar",
last_name: "Test"
},
on_conflict: {
constraint: customers_merchant_id_email_key,
update_columns: [first_name, last_name]
}
)
{
returning {
id
}
}
}
{
"errors": [
{
"extensions": {
"path": "$.selectionSet.insert_customers.args.objects",
"code": "constraint-error"
},
"message": "constraint \"customers_merchant_id_email_key\" for table \"customers\" does not exist"
}
]
}
Are we missing something?