How to rename a subgraph in federation?

How do I rename a subgraph or service in my federation schema?

You can rename a subgraph following this high-level steps:

  1. Publish the subgraph to Studio with its new name. Composition will likely break at this point due to duplicate entity definitions, etc., but that’s OK because Studio will not incorporate the subgraph until composition succeeds.
  2. Run rover subgraph delete to remove the subgraph under its old name.
  3. Composition succeeds, the “new” configuration of the graph is now available with the subgraph name updated.

Two things to keep in mind when you do this:

  • First, you’ll want to ensure that the subgraph name is updated anywhere that the rover subgraph command is used in your CI/CD workflows.
  • Second, to keep things tidy and easy to reason about, I would decouple this name change step from any other changes you plan on making to the subgraph’s schema. In other words, make the name change as its own distinct step.