Prisma1: Problems when changing the cardinality of a relationship

Created on 6 Nov 2017  Â·  5Comments  Â·  Source: prisma/prisma1

Current behavior

Calling 'graphcool deploy' on the types.graphql file at https://gist.github.com/zlandau2/8d503b680cacfbf7b3d5bc3ecec2883c is failing with:

✖ You can only create scalar fields and 'Item' is not a scalar value. Did you intend to create a relation?

The only changes I made between a working are shown here: https://gist.github.com/zlandau2/ad636baba884c4683cef0dc498b76fe7. That is, I was trying to fix storage and items to be lists instead of single items.

Reproduction

Call 'graphcool deploy' with the types.graphql file linked to there. You can look at https://github.com/zlandau2/graphcool-relation-error/ to see the full state of the repo.

Expected behavior?

I believe I should be able to push the changes in the types.graphql.

Most helpful comment

In my case the schema is in flux a lot because I'm in early development, so I don't care about existing data at all. In this case a good migration flow isn't important, so it'd be nice if there was a deploy --seriously-force-it-all-with-wild-abandon

Is there a good workaround for now, or do I need to create a new project?

All 5 comments

This is the second time I have seen an example of a schema that deploys succesfully when you paste it in a new project. Both times it was related to changing the cardinality of a relationship (either from 1 to many, or in the other example, from many to 1). I believe this error is somehow related to that. @timsuchanek?

I would argue that the underlying topic here is that a proper migration flow is needed for cases like this. Changing the cardinality of a relationship is one use case I mentioned in my musings here #730.

In my case the schema is in flux a lot because I'm in early development, so I don't care about existing data at all. In this case a good migration flow isn't important, so it'd be nice if there was a deploy --seriously-force-it-all-with-wild-abandon

Is there a good workaround for now, or do I need to create a new project?

Delete the target from your .graphcoolrc. This will generate a new serviceId though, but if that's not an issue, it means you're doing a fresh deployment every time.
You can clean up your shared cluster services with graphcool delete oldServiceId

Please join the discussion here: https://github.com/graphcool/framework/issues/1263

Was this page helpful?
0 / 5 - 0 ratings