postgraphile-plugin-nested-mutations icon indicating copy to clipboard operation
postgraphile-plugin-nested-mutations copied to clipboard

Delete mutations not visible

Open Tam opened this issue 4 years ago • 1 comments

The delete mutations aren't available in the Update patch relation, even though there is a top-level delete mutation available for the relation.

Available nested mutations:

connectByCurrencyIdAndCountryId: [CurrencyCountryCurrencyCountryPkeyConnect!]

connectByNodeId: [CurrencyCountryNodeIdConnect!]

updateByCurrencyIdAndCountryId: [CurrencyCountryOnCurrencyCountryForCurrencyCountryCountryIdFkeyUsingCurrencyCountryPkeyUpdate!]

updateByNodeId: [CountryOnCurrencyCountryForCurrencyCountryCountryIdFkeyNodeIdUpdate!]

create: [CurrencyCountryCountryIdFkeyCurrencyCountryCreateInput!]

Available root delete mutation:

Mutation.deleteCurrencyCountry

The table schema:

create table if not exists pivot.currency_country (
  currency_id uuid references public.currency(id) on delete cascade,
  country_id  uuid references public.country(id) on delete cascade,
  primary key (currency_id, country_id)
);

comment on table pivot.currency_country is E'@omit all';

comment on constraint currency_country_currency_id_fkey on pivot.currency_country is E'@fieldName currency\n@foreignFieldName countries';
comment on constraint currency_country_country_id_fkey on pivot.currency_country is E'@fieldName country\n@foreignFieldName currencies';

alter table pivot.currency_country enable row level security;

revoke all on table pivot.currency_country from anonymous, member;
grant select on table pivot.currency_country to anonymous, member;

revoke all on table pivot.currency_country from admin;
grant all on table pivot.currency_country to admin;

drop policy if exists pivot_currency_country_select on pivot.currency_country;
create policy pivot_currency_country_select on pivot.currency_country for select
  using (true);

drop policy if exists pivot_currency_country_all on pivot.currency_country;
create policy pivot_currency_country_all on pivot.currency_country for all
  using (util.is_admin());

The above should give admin users permissions to not only create but also delete relations.

Tam avatar Jun 29 '21 14:06 Tam

Same issue here but in my case removing the PrimaryKeyMutationsOnlyPlugin plugin forked from graphile-starter fixed it. You might have some similar plugin that created the conflict. Hope that helps @Tam

My env:

  • postgraphile 4.12.3
  • postgraphile-plugin-nested-mutations 1.1.0
  • node v14.17.4

vnphanquang avatar Aug 15 '21 03:08 vnphanquang