Is there a way to get test user data into my graph...
# prisma-whats-new
s
Is there a way to get test user data into my graph.cool so I can do some test queries ?
n
@sven I'd suggest running a small script that populates some data. I can help you out with that πŸ™‚
s
that would be great
I am new to graphQL and was hoping to play around in the playground a little before setting it up with my react app
n
Right! How many models do you have?
s
5 while I am not planning to use β€˜File’ yet
with models you mean types ?
n
yes πŸ™‚
s
all other types, besides user I can populate through the UI
n
Oki, here's a super simple mutation to create nodes for one type: https://github.com/graphcool-examples/scripts/blob/master/delete-nodes.js#L59-L64
s
(and file)
n
you can use nested mutations to create nodes across relations with only one mutation
Hopefully that can act as a starting point. Let me know if you need more help πŸ™‚
depending on how much data you need, using the playground to populate the data may be easier
s
two test users would be enough
n
Ahh ok. Then the scripts are probably not needed πŸ˜›
s
how would it work through the playground?
n
you can run this mutation (I assumed some fields on your
User
model, you have to make sure to include at least all required fields in a create mutation):
Copy code
mutation {
  createUser(
    name: "Nilan"
    age: 25
    gender: MALE
  ) {
    id
  }
}
s
will try thanks
that was easy
thanks
I wonder why this is not possible through the UI ?
n
the
User
model has a special interaction with the available Authentication providers
If you use Auth0 for example, it's only possible to create a new user by supplying a valid Auth0 idToken
s
so if I wanted to activate that later I would need to delete existing user data?
n
Do you have any authentication provider activated?
s
no
n
You don't have to delete any data when activating an auth provider, however without one, users can't authenticated themselves.
You also can't attach authentication info to an existing user row.
s
okay cool