In this chapter, you’ll evolve the schema of the Graphcool project by adding the additional types and relations that you need for the Hackernews clone.
Note that all the actions that you can do with the CLI, you can also perform using the web-based console. In this tutorial, we focus on the CLI so you learn how to manage your Graphcool project with a local workflow.
The first thing you have to do is update the schema of your project. You can do that by simply making changes to your project file:
All you do here is adding the types to get the full schema that we introduced in the previous chapter.
For these changes to take effect, you now need to “sync” with the schema that’s still stored on the server. You can use the
graphcool push command for that.
Before you’re performing
graphcool push, you can also run the
graphcool statuscommand that will output the list of potential changes without actually performing them.
The CLI output will provide the information about all changes that were applied to the schema on the server-side:
$ graphcool push ✔ Your schema was successfully updated. Here are the changes: | (+) A new type with the name `Vote` is created. | | (*) The type `User` is updated. ├── (+) A new field with the name `name` and type `String!` is created. | | (+) The relation `UsersVotes` is created. It connects the type `User` with the type `Vote`. | | (+) The relation `UsersLinks` is created. It connects the type `User` with the type `Link`. | | (+) The relation `VotesOnLink` is created. It connects the type `Link` with the type `Vote`. Your project file project.graphcool was updated. Reload it in your editor if needed.
If you want to verify that your project’s schema was actually updated, you can open the schema editor in the Graphcool Console and check if the new types and relations are now actually available:
Learn best practices for implementing email-password authentication and defining permission / authorization rules on a GraphQL server with Graphcool.