hasura / hasura/graphql-engine

Foreign key update/delete violation are neither tracked in metadata nor picked up from the database

Open
#9,529 1 comment 1 reaction 0 assignees View on GitHub
k/bug t/product-platform
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.16.0-ce
CLI Version (for CLI related issue):

### Environment

OSS

### What is the current behaviour?

I'm using Hasura as graphql-engine that connects with a database (not schema controlled by Hasura migrations) and provide GraphQL API on top of it.

The update/delete violation on foreign key are managed by Django through it's own migration on this database. I realized Hasura doesn't picks up this from the DB, but you have to explicitly track foreign keys and also state the on-update/delete violation for each foreign-key field there.

So, far it's okay, I just did that and everything works, but I realized that when I do metadata export, Hasura doesn't keep this information in it's metadata and I cannot easily migrate to other enviroments.

### What is the expected behaviour?

Either Hasura should pick this information directly from the database it's interacting with, or if overridden in the Hasura panel, then it should be stored as metadata so as to be exported into different environments.

### How to reproduce the issue?

1. Connect to a database whose schema is not controlled by Hasura
2. Track table and foreign key relationships
3. Track violations for foreign-key, but update/delete mutation throws an error.

### Screenshots or Screencast

Screenshot 2023-03-27 at 3 09 21 PM

### Please provide any traces or logs that could help here.

### Any possible solutions/workarounds you're aware of?

A possible workaround is replicating each change manually in all the environments which is error-prone.

### Keywords

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.