How to implement ReloadSchemaIndicator to change schema in runtime? #1019
-
|
I have a Spring Boot backend already DGS implemented with changing database: users can create new tables and new columns, also, can create relations. What I want is to create some dynamic structure which does build new queries according to created tables and columns. I read about the ReloadSchemaIndicator and Dynamic Schemas documentation. But I could not figure it out how can I do it. Maybe it is impossible to change graphql schema in runtime. Do anyone know? Also, I think we need more information about ReloadSchemaIndicator on documentation because I could not understand if I did not read the source code. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
The You could maybe trigger an event based on the user making a change to the database and set it to reload. |
Beta Was this translation helpful? Give feedback.
The
ReloadSchemaIndicatoris really just logic that givestrueorfalse. By default, it will always use the cached schema for obvious performance reasons. You implement aReloadSchemaIndicatorwith whatever logic you need to decide "I need to build a fresh schema".At Netflix we detect when we run on a developer machine (as opposed to the cloud), and always reload the schema in that case.
You could maybe trigger an event based on the user making a change to the database and set it to reload.