When I have a model like below:
""" @model """
type Note {
id: ID!
"""
@db.name: 'note_title'
"""
title: String!
}
I am getting an error
"message": "insert into \"note\" (\"title\") values ($1) returning * - column \"title\" of relation \"note\" does not exist",
with the following mutation
mutation {
createNote(input: { title: "mambo" }) {
id
title
}
}
Yeah this is known, and possibly https://github.com/aerogear/graphback/issues/637 covers this already with some previous discussions.
We have never supported automatic mapping, but it is a useful migration feature to have, independent of Graphback. The docs suggest manually mapping these in resolvers but we don't generate them anymore, so this becomes difficult.
Yeah this is known, and possibly #637 covers this already with some previous discussions.
We have never supported automatic mapping, but it is a useful migration feature to have, independent of Graphback. The docs suggest manually mapping these in resolvers but we don't generate them anymore, so this becomes difficult.
Thanks, a very insightful response. I ran into this issue when I was working on https://github.com/aerogear/graphback/pull/1509.
I suppose I'd need to add some mapping of queryable fields to make sure that the fields are selected from database before in a way that our suggested approach in the Documentation will continue to work.
Adding name will have serious impact on the 2 factors:
It is one of those annotations that we experimented with so I will suggest to remove it rather than try to retrofit it.
Fine with that - but we should only remove it from Graphback docs IMO - It is useful for graphql-migrations (thinking upstream)
Adding name will have serious impact on the 2 factors:
- It will need to be postgress only (unless we do mongodb migrations)
- I will rename column at runtime when db migration is there.
It is one of those annotations that we
experimentedwith so I will suggest to remove it rather than try to retrofit it.
You have my +1.
We ca probably rename this issue title to reflect that.
Fine with that - but we should only remove it from Graphback docs IMO - It is useful for graphql-migrations (thinking upstream)
Yes. Sorry for not being clear about this.
I'll close this, since we made the decision to not support it. Feel free to reopen if I am wrong.
I'll close this, since we made the decision to not support it. Feel free to reopen if I am wrong.
We still support @db(name: 'column_name') on field https://github.com/aerogear/graphback/blob/bc077a1d78571b58fdd4580376cd1dad074d7af6/packages/graphql-migrations/src/abstract/generateAbstractDatabase.ts#L224. Maybe we should rename this title to actually dropping the support for it?
We support customising the name in graphql-migrations, but Graphback does not support mapping this rename.
Yeah sure, makes sense!