graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

Improve inconsistency resolution for dropped columns

Open BenoitRanque opened this issue 3 years ago • 1 comments

Is your proposal related to a problem?

Dropping columns for which there are permissions causes metadata inconsistency. Resolving those inconsistencies by deleting relevant metadata objects deletes the entire permissions, instead of only removing the specific column.

Describe the solution you'd like

Deleting related metadata should only remove the metadata specific to the column, not the entire permission.

Reproduction steps

  1. Create and track the following table: image
  2. Add permissions for this table, note the columns are referenced image
  3. Delete the referenced columns. An error will be thrown, and you will be prompted to continue image
  4. click continue. The permissions are now deleted entirely

Alternative reproduction steps:

  1. Create and track the following table
CREATE TABLE test (
  id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
  a TEXT,
  b TEXT,
);
  1. Add permissions (see step 2 above)
  2. Drop a column. Note this will be prevented from the console due to inconsistency, but is possible through other means
ALTER TABLE test
DROP COLUMN b;
  1. Reload metadata, and from the metadata inconsistency screen select to delete metadata objects.
  2. Once again, the entire permission for the table are removed, instead of only removing the column from the permissions.

BenoitRanque avatar Mar 31 '22 16:03 BenoitRanque

Related (possibly dupe) here: https://github.com/hasura/graphql-engine/issues/8467

tirumaraiselvan avatar May 24 '22 10:05 tirumaraiselvan