Prisma1: Changing a scalar to a relation field results in None.get

Created on 14 Nov 2017  路  5Comments  路  Source: prisma/prisma1

Current behavior

Changing a scalar field to a relational field results in "None.get" error when deploying. Force deploying shows the same behaviour.

Reproduction

  • graphcool init
  • graphcool deploy
  • change types.graphql to the following (note that it was previously name: String and now name: Name @relation(name: "Name"):
type User @model {
  id: ID! @isUnique
  name: Name @relation(name: "Name")
  dateOfBirth: DateTime
}

type Name @model {
  id: ID! @isUnique
  name: String
  owner: User @relation(name: "Name")
}
  • graphcool deploy -> "None.get"
  • graphcool deploy --force -> "None.get"

Expected behavior?

  • graphcool deploy should probably abort
  • graphcool deploy --force should remove the name: String field, and add a new relation Name between User and Name with the fields name: Name on User and owner: User on Name.

Most helpful comment

I am stucked in the same error, We need to be able to edit the schema in any scenario, projects grow and need new types, relations, delete the old ones, etc. As far as I can see It complains when you try to update the schema or if you change a scalar field to a relation, in other words is quite limiting when you want to add upgrades to your app. @marktani if you have any suggestions let me know. Thanks :)

All 5 comments

I am stucked in the same error, We need to be able to edit the schema in any scenario, projects grow and need new types, relations, delete the old ones, etc. As far as I can see It complains when you try to update the schema or if you change a scalar field to a relation, in other words is quite limiting when you want to add upgrades to your app. @marktani if you have any suggestions let me know. Thanks :)

The workaround is first deleting the scalar field, then adding the relation.

thanks @marktani i'll try it now
first i'm having another error now when deploying exactly the same schema
The fieldidis a system field and cannot be updated.
note: ok i replaced ID by ID!

note: that worked, thanks @marktani

We're currently designing a new migration workflow, would love to get your input: https://github.com/graphcool/framework/issues/1263

Thanks 馃憤

@marktani Sure, thanks for helping.

Was this page helpful?
0 / 5 - 0 ratings