Taken from https://github.com/graphcool/graphcool-cli/issues/142
When using the CLI, any renamed relations seem to be ignored.
Here's my base schema:
type Device implements Node {
createdAt: DateTime!
id: ID! @isUnique
updatedAt: DateTime!
user: User @relation(name: "UserDevices")
}
type User implements Node {
createdAt: DateTime!
devices: [Device!]! @relation(name: "UserDevices")
id: ID! @isUnique
updatedAt: DateTime!
}
Let's say I make a modification, like this:
type Device implements Node {
createdAt: DateTime!
id: ID! @isUnique
updatedAt: DateTime!
user: User @relation(name: "DevicesOnUser")
}
type User implements Node {
createdAt: DateTime!
devices: [Device!]! @relation(name: "DevicesOnUser")
id: ID! @isUnique
updatedAt: DateTime!
}
The docs for relation migration seem to indicate that I need to modify the @relation directive on both fields. When I submit the above schema migration via graphcool push, I get this error:
✔ Identical schema, no action required.
However, copying and pasting into the Graphcool console works just fine (the relations are updated properly).
The docs are wrong in the way they describe the rename operation. It is necessary to provide an oldName argument to the directive to trigger a rename. Using this notation it actually works.

But we should be detecting that an invalid rename was attempted. And we also need to handle the renaming of the corresponding relationpermissions.
I'm leaving this open until we fix these related issues.
It makes sense to provide the oldName when you rename a field, otherwise you cannot distinguish between a rename and a delete+new. However, for relations, the fieldname does not change, and neither do the field types, so why is it necessary to provide an oldName here?
@kbrandwijk as you can see, the oldName references the old relation name.
@do4gr it definitely used to work as described in the OP before 🙂
We want to move away from the @rename and @migrationValue directives anyway, as they make it difficult to apply the same migrations to different environments. See here for a discussion on a possible migration concept: https://github.com/graphcool/graphcool-cli/issues/173.
This topic will be covered in the reworked docs anyway, so I think for now we can close this issue.
After some discussion we decided to reopen this again since there is still no definite solution.
Closing this again ;-)
Most helpful comment
After some discussion we decided to reopen this again since there is still no definite solution.