hasura / hasura/graphql-engine
Insert queries should only set necessary columns
- 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
Assessment
This issue has not been assessed yet.