hasura / hasura/graphql-engine

Insert queries should only set necessary columns

Open
#7,567 0 comments 0 reactions 0 assignees View on GitHub
k/enhancement
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Is your proposal related to a problem?

After removing database columns, inserts performed by Hasura can fail with "column does not exist" despite the fact that these columns aren't needed for the insert. This makes managing zero downtime database migrations a lot more awkward.

### Describe the solution you'd like

I would prefer if the database query Hasura generates only included those columns that I'd passed in as keys for the object to insert, e.g.

query
```
mutation createContact ($contact: core_contact_insert_input!) {
insert_core_contact_one(object: $contact) {
uuid
}
}
```

variables:
```
{
"contact": {
"email": "daniel@example.com",
"source": "WEB"
}
}
```

should generate the query:
`INSERT INTO core_contact (email, source) values ('daniel@example.com', 'WEB')`

Then we would not need to be concerned about the Hasura metadata being temporary out of sync during database migrations.

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.