https://www.prisma.io/ logo
Join Slack
Powered by
# orm-help
  • p

    peter

    06/26/2018, 3:26 PM
    any
    graphql-yoga
    examples that show how to add routes and controllers?
  • j

    Jim

    06/26/2018, 3:47 PM
    Should the generated/prisma.graphql be generated after you run
    prisma deploy
    ?
    j
    • 2
    • 4
  • p

    playra

    06/26/2018, 4:45 PM
    is there an example of password recovery by mail?
    e
    • 2
    • 4
  • t

    terion

    06/26/2018, 6:25 PM
    Prisma doesn't have
    ON DELETE RESTRICT
    ?? Why? There is no action, set null and cascade, but no restrict?
  • t

    tz

    06/26/2018, 6:44 PM
    Not sure if this question has been asked before. I see there is a
    prismagraphlq/prisma-prod
    docker image , is this what I am supposed to use for production deployment?
  • c

    Chris H

    06/26/2018, 7:55 PM
    I setup a Fargate instace of prisma with an Aurora database per this tutorial:https://www.prisma.io/docs/tutorials/deploy-prisma-servers/aws-fargate-joofei3ahd/. I then went into Prisma Cloud to add the server per this video:

    https://www.youtube.com/watch?v=Wjt9Hy_BI2M&t=10s▾

    . When I add the endpoint and the managementApiSecret, I get the following error:
    Copy code
    Variable '$_input' cannot be non input type 'SetCloudSecretInput!'. (line 1, column 20): mutation ($_input: SetCloudSecretInput!) { ^ Unknown type 'SetCloudSecretInput'. (line 1, column 20): mutation ($_input: SetCloudSecretInput!) { ^ Cannot query field 'setCloudSecret' on type 'Mutation'. (line 2, column 3): setCloudSecret(input: $_input) { ^
    I can access the Prisma instance and create a service from
    prisma init
    without a hitch but I can't add the server to Prisma Cloud. Anyone have some insight on this?
  • g

    Gorodov Maksim

    06/27/2018, 3:56 AM
    I have such mutation - https://gist.github.com/SilencerWeb/9384ffc2ef12cd3fdf718f1834808493 You can see the mutation and call example on this gist. I cannot understand why I get
    [ { side: 'left' }, { side: 'left' } ]
    here - https://gist.github.com/SilencerWeb/9384ffc2ef12cd3fdf718f1834808493#file-index-js-L46 instead of something like
    [ { person: 'cjiwj0g5kztyu0a277xe3tt2j', side: 'left' }, { person: 'cjiwj0g5kztyu0a277xe3tt2j', side: 'left' } ]
    . Strange part is that these created `ActionMember`s are saved in the database correctly -
    [ { person: 'cjiwj0g5kztyu0a277xe3tt2j', side: 'left' }, { person: 'cjiwj0g5kztyu0a277xe3tt2j', side: 'left' } ]
    , but I get another result in my
    console.log
    . What can be the reason of such behavior?
    m
    • 2
    • 1
  • g

    Gorodov Maksim

    06/27/2018, 3:58 AM
  • p

    picosam

    06/27/2018, 9:41 AM
    Hello there! What’s the proper way of renaming an enum value in Prisma when we have existing data?
  • m

    matic

    06/27/2018, 9:45 AM
    Hey @picosam have you tried this https://www.prisma.io/docs/reference/service-configuration/data-model/data-modelling-(sdl)-eiroozae8u#temporary-directives ?
  • p

    picosam

    06/27/2018, 9:48 AM
    Hey @matic! So that would work for an enum value too?
  • a

    Arnab

    06/27/2018, 9:49 AM
    @picosam: How do you save your data? If your data is made up of events and projections, it would be fairly easy to accomplish this.
  • m

    matic

    06/27/2018, 9:49 AM
    @picosam I am not 100% percent sure. It might as well throw an error during Service Deployment. Maybe you could try creating a artificial model and test it out.
    p
    • 2
    • 6
  • p

    picosam

    06/27/2018, 9:50 AM
    I’ll try on my staging server then first
  • p

    picosam

    06/27/2018, 9:50 AM
    Thanks guys!
    prisma green 1
  • p

    picosam

    06/27/2018, 9:50 AM
    @Arnab I’m not sure I understand to be honest lol
    a
    • 2
    • 4
  • n

    nilan

    06/27/2018, 9:57 AM
    Please use threads 🙂
    👍 4
    🙏 2
  • z

    zonofthor

    06/27/2018, 10:38 AM
    I want to duplicate a complex node, is there any way to do that easily without a long query to catch all fields I need to copy? something like
    select *
    ?
    n
    • 2
    • 1
  • j

    Jim

    06/27/2018, 11:17 AM
    Im able to have a resolver that returns a user:
    Copy code
    type Mutation {
    	loginOld: User!
    }
    
    async loginOld(parent, args, ctx, info) {
    	const authId = await getUserAuthId(ctx);
    	const existingUser = await ctx.db.query.user({ where: { authId } }, info);
    	return existingUser;
    },
    However what I actually want to do is look for a user in the database and return a string:
    Copy code
    type Mutation {
    	login: LoginFeedback
    }
    
    type LoginFeedback {
    	value: String!
    }
    
    async login(parent, args, ctx, info) {
    	const authId = await getUserAuthId(ctx);
    	const userExists = await ctx.db.query.user({ where: { authId } }, info);
    	if (userExists) return {value: "A user exists"}
    	return {value: "No user exists"}
    }
    Even If I don’t do anything with userExists, as soon as I query the database I get an error message:
    Copy code
    Field 'user' of type 'User' must have a sub selection. (line 2, column 3):\n  user(where: $_v0_where)\n  ^
    I think this is the schema getting upset as Ive said the type is LoginFeedback not Login, but is there not a way to query the Prisma database in mutation?
    m
    l
    • 3
    • 12
  • g

    Gorodov Maksim

    06/27/2018, 11:39 AM
    How can I use endpoint from .env in prisma.yml?
    l
    • 2
    • 13
  • t

    ttimm

    06/27/2018, 11:45 AM
    Hey guys, I have a question about prisma with multi tenancy. I want to create a new web view for some of our data. We have one main database and several account specific databases. How would i connect or setup prisma?
  • m

    Moritz

    06/27/2018, 11:52 AM
    Hi there, there appears to be an issue with
    prisma reset
    at the moment. I am resetting one of my endpoints, but the data presist. I double checked that I am resetting the right endpoint. Has anyone experienced similar behavior?
    n
    • 2
    • 8
  • s

    Shakti

    06/27/2018, 11:57 AM
    I'm trying to run the prisma for first time by following this tutorial: https://www.prisma.io/docs/tutorials/setup-prisma/connect-empty-db/mysql-dusee0nore Executed this command: docker-compose up -d Starting my_project_prisma_1 ... done Finally when executed the 'prisma deploy' command, getting following error: Could not connect to server at http://localhost:4466. Please check if your server is running. Any help?
    d
    • 2
    • 1
  • n

    noahdavis

    06/27/2018, 12:23 PM
    Is there any way to specify shorter data types for specific string data points? We have noticed that Prisma creates mediumtext types for all of the strong fields and in many cases this is way larger than what we need.
    n
    • 2
    • 2
  • d

    dmce

    06/27/2018, 12:39 PM
    Hi, after a
    prisma deploy
    and a post deploy hook to
    graphql get-schema
    how can i import the whole generated schema into my own (as i have some rest API stuff as well), rather than
    # import OneThing from "./generated/schema.graphql"
    m
    • 2
    • 12
  • l

    linkdd

    06/27/2018, 3:23 PM
    Let's say i have a file
    datamodel.graphql
    that I deployed on Prisma, is there a way to regenerate that file by querying Prisma ? I know that with GraphQL we can introspect the API, but this will give me the schema of the generated API, not the source. It may be possible to infer the source from the generated API but it seems complex. I need this to be able to generate a diff between a
    datamodel.graphql
    I have locally and the actual deployed schema.
  • h

    hez

    06/27/2018, 4:39 PM
    Is it possible to do something like live queries currently in Prisma/Apollo? I have a third party REST endpoint that I need to poll for pretty much the entire usage cycle of my application. And I've got it wrapped in GraphQL on the server side, as our API is built with Prisma/Apollo... Right now, this is just a simple query that passes the request along to the REST endpoint, then cherry picks some things out of the response, along with adding in some extra data...and pushes a response back to the client application. It'd be hell of slick if our client application didn't have to repeatedly hit our endpoint... My gut says that is not really possible, though.
  • p

    peter

    06/27/2018, 5:29 PM
    can anyone shed light on the proper ordering when adding express routes to a
    graphql-yoga
    server?
  • i

    Ian

    06/27/2018, 6:46 PM
    My relationships don't seem to work. I've setup
    Copy code
    type User{
      id: ID! @unique
      name: String!
      rating: Int! @default(value: "0")
      createdAt: DateTime!
      updatedAt: DateTime!
      listings: [Listing!]! @relation(name: "ListingsByUser" onDelete: CASCADE)
    }
    
    type Listing {
      id: ID! @unique
      title: String!
      content: String!
      published: Boolean! @default(value: "true")
      createdAt: DateTime!
      updatedAt: DateTime!
      author: User! @relation(name: "ListingsByUser")
    }
    My seed:
    Copy code
    mutation {
    
        user: createUser(
            data: {
                name: "Ian Jamieson"
                rating: 0
                listings: {
                    create: {
                        title: "Test title"
                        content: "lorem ipsum"
                    }
                }
            }
        ) {
            id
        }
    
    }
    Listing returns the user ok, but my user listings returns null
    Copy code
    {
      "data": {
        "users": [
          {
            "id": "cjiw9mopw000407197os3fu9d",
            "name": "Ian Jamieson",
            "rating": 0,
            "listings": null
          }
        ]
      }
    }
    Is there something I'm missing? Found out it's my resolvers index.js
    Copy code
    import * as path from "path";
    import { mergeResolvers, fileLoader } from "merge-graphql-schemas";
    
    const resolversArray = fileLoader(path.join(__dirname, "./**/*.resolvers.*"));
    
    const resolvers = mergeResolvers(resolversArray);
    
    export default resolvers;
    So how do i merge them properly?
    n
    • 2
    • 3
  • s

    Stephen

    06/27/2018, 8:57 PM
    Evening .
1...666768...637Latest