T
Twenty4mo ago
Bhavin

Schema Update to generate custom query/mutation

i want to create custom graphql schema for my additional requirements. We have added new role based authentication feature and for that everytime we wrote new schema we have to reset the database. how can we update schema ?? @charles
5 Replies
charles
charles4mo ago
Hi @Bhavin, thanks for opening a thread here 🙂 So, when you say "we write a new schema", do you mean that you create a new workspace-entity (aka standard object) in the code ? or are you manually registering custom resolvers in your graphql schema?
Bhavin
BhavinOP4mo ago
Hello @charles , Let me explain it to you so I have created custom fields and new entities in workspace schema successfully but every time to reflect this change i have to reset database using this command : yarn nx database:reset twenty-server . I think this is not reliable for us as of now because it basically empties our database when we perform this. We just want to run migrations or reflect this changes without using above command. Yes, we would like to add new entity. So if we try to add any new field or new table then it should get synced with database / schema .
charles
charles4mo ago
okay! You can use the following command to only sync your workspace entities (aka standard object debscribed in code) to your object metadata (aka the one used by twenty engine at runtime, particularly to generate the graphql schema): - locally (contributor mode): npx nx run twenty-server:command workspace:sync-metadata -f - production (self-host mode): yarn command:prod workspace:sync-metadata -f
Bhavin
BhavinOP4mo ago
Thanks @charles . I got it working
charles
charles4mo ago
Great!
Want results from more Discord servers?
Add your server