1

I am using Postgraphile (with the many-to-many plugin) with three tables: foos, bars, and foo_bars. foo_bars is a simple join table with foo_id and bar_id columns, which have foreign key constraints to the corresponding table.

When I look at GraphiQL I can see that there is a createFooBar mutation, which let's me create a record in that JOIN table. However, once I create a record, there appears to be no way to remove or change it, as there is no updateFooBar or deleteFooBar mutation, and neither the updateFoo or updateBar mutations seem to have a way to affect foo_bar.

So, simple question: how do I change JOIN table records in Postgraphile?

P.S. The relevant documentation page, https://www.graphile.org/postgraphile/relations/, doesn't offer any help.

machineghost
  • 33,529
  • 30
  • 159
  • 234

1 Answers1

1

When the update/delete mutations are missing on a table (join or otherwise) the most common reason is that there is no primary key or unique constraints on the table. Try adding a primary key to your table then restarting PostGraphile.

Benjie
  • 7,701
  • 5
  • 29
  • 44