graphql-engine
graphql-engine copied to clipboard
Improve inconsistency resolution for dropped columns
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
- Create and track the following table:

- Add permissions for this table, note the columns are referenced

- Delete the referenced columns. An error will be thrown, and you will be prompted to continue

- click continue. The permissions are now deleted entirely
Alternative reproduction steps:
- Create and track the following table
CREATE TABLE test (
id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
a TEXT,
b TEXT,
);
- Add permissions (see step 2 above)
- 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;
- Reload metadata, and from the metadata inconsistency screen select to delete metadata objects.
- Once again, the entire permission for the table are removed, instead of only removing the column from the permissions.
Related (possibly dupe) here: https://github.com/hasura/graphql-engine/issues/8467