Where to declare schema?

Hi, this is a noob question, but I couldn’t find a good example of how to declare a schema on the server. I’m using ParseServer() in an Express app, and my front-end plans to consume GraphQL.

I see the documentation for new Parse.Schema, but don’t understand where to put this code.

I’m looking through github - (search?l=JavaScript&q=%22new+Parse.Schema%22&type=Code) for examples.

What’s the best practice? Do you know of an example?

I’d like to declare the schema on the server, update it without having lots of migration issues, and use it with GraphQL,

Thank you!

@MichaelJCole , currently the pre defined parse schemas feature is not support.
But here a conversation about a script that i use on many projects to support this feature.
(Script used in production)

OR

Direct link to the script: https://gist.github.com/Moumouls/e4f0c6470398efc7a6a74567982185fa

(the feature will be available in 2021)

4 Likes

Wow nice magic with serverStartComplete, I had had to use hack with setting a delay(~300ms) before setting permissions and checking/setting class/columns - at first start from scratch there were errors because db didn’t have time for creating before my checking started.

I am pleased to announce that the feature is currently under active development to be part of Parse Server: Defined Schemas with auto migration by Moumouls · Pull Request #7091 · parse-community/parse-server · GitHub

2 Likes

Just some update here, this feature is now supported since Parse v5.0

The docs PR is still under validation, but you can check the futur docs here: docs: add defined schema docs by Moumouls · Pull Request #863 · parse-community/docs · GitHub

1 Like