How to delete / flush files in .graphql-generated

I use SilverStripe 4.11

A normal “?flush=1” does not remove the files in “.graphql-generated”, right?

I had the problem twice that the asset admin only showed an error message

“Unknown graphql type: Query”

The first time I accidentically rsynced my local .graphql-generated files to the live server.

The second time I have no idea what caused it.

But both times the solution was to delete the files in “.graphql-generated/admin/*”.

Is there already a suitable way to delete these files?
And am I correct in assuming that since they are only used to cache recurring requests, I can safely delete these files?

I’m thinking about writing a helper script that the CMS users can run just by calling an URL.
Just in case the asset admin hangs again.

By default, the schema is built during a dev/build not a flush operation. (You should see some output at the bottom of the dev/build response)

You can force the regeneration of the graphql specifically without a full dev/build with the dev/graphql/build operation.

Both of the above operations will need you to be an admin user (or be run from the command line) when the site is in Live mode.

1 Like