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

    soren

    08/04/2019, 2:14 PM
    I'm using the same endpoint that was given to me in docker inside prisma.yml
  • j

    Jo

    08/04/2019, 2:44 PM
    @soren what type of db are you using? Where are you using this ip address that causes the error
  • i

    impowski

    08/05/2019, 8:30 AM
    Hey guys, I’ll ask again, has anyone been able to implement a generation of custom directives with
    nexus
    and
    nexus-prisma
    ? I need to be able to use it with
    apollo-server
    and have no idea how to get it working and generate
    schema.graphql
    with it.
    m
    h
    • 3
    • 3
  • c

    Chad H

    08/05/2019, 10:09 AM
    if I have no preference between mysql or postgresql, what is the better option to use with prisma? I understand mysql is the first DB used with prisma but does it mean it's more stable?
    j
    j
    • 3
    • 4
  • k

    kitze

    08/05/2019, 3:17 PM
    What are you using for storing images? Cloudinary? S3 Buckets? 🤔
    h
    • 2
    • 1
  • j

    Jo

    08/05/2019, 3:27 PM
    What version of typescript is prisma using for index.d.ts?
    🙂 2
    e
    h
    • 3
    • 5
  • b

    Bill Pliske

    08/05/2019, 4:18 PM
    1. Say I have a String field called Category. 2. One of those Category names is “Bank” 3. I have around 100 entries that used “Bank” as their Category name. 4. What if I wanted to rename “Bank” to “Account”? 5. Is there a “safe” way to let the user do this, and it automatically updates all 100 entries? Looking for general guidance here, not the solution. Thanks!!
    h
    • 2
    • 1
  • j

    Jeremiah

    08/05/2019, 6:58 PM
    I'm trying to create a model for storing match info for a game, but I'm getting the error
    You are trying to set the relation 'BlueTeam' from 'Match' to 'Team' and are only providing a relation directive with a name on 'Match'. Please also provide the same named relation directive on the relation field on 'Team' pointing towards 'Match'.
    Here's my model:
    Copy code
    type Match {
      id: ID! @id
      players: [Player!]! @scalarList(strategy: RELATION)
      red: Team! @relation(name: "RedTeam")
      blue: Team! @relation(name: "BlueTeam")
      winner: String!
      createdAt: DateTime! @createdAt
      updatedAt: DateTime! @updatedAt
    }
    
    type Team {
      id: ID! @id
      top: Player! @relation(name: "Top")
      jungle: Player! @relation(name: "Jungle")
      mid: Player! @relation(name: "Mid")
      carry: Player! @relation(name: "Carry")
      support: Player! @relation(name: "Support")
      matches: [Match]! @scalarList(strategy: RELATION)
    }
    
    type Player {
      id: ID! @id
      role: String!
      matches: [Match]! @scalarList(strategy: RELATION)
      createdAt: DateTime! @createdAt
      updatedAt: DateTime! @updatedAt
    }
    What is a fix for this or is there a better way to represent the teams?
    h
    • 2
    • 6
  • j

    Jo

    08/05/2019, 8:43 PM
    Why does Prisma use default database. Is this by design?
    h
    r
    • 3
    • 6
  • p

    Pedro Jardim

    08/05/2019, 11:13 PM
    Hello guys, I'm having problems with error 413 on my Graphql yoga. "Request entity too large". When I run my query on Prisma Server (playground) it works fine, but when run on my graphql service(graphql-yoga/playground) I get the 413 error. Any idea how to fix it?
    h
    • 2
    • 1
  • n

    Neme Sáenz

    08/06/2019, 2:51 AM
    Does anyone know if dynamodb is gonna be available to be used with Prisma?
    h
    • 2
    • 2
  • c

    Chad H

    08/06/2019, 11:52 AM
    I'm having some issue with
    prisma deploy
    . when I run this on ubuntu, I kept getting "Service is already up to date." when in fact there is nothing generated on the database. If I run
    prisma delete
    , I get ERROR: GraphQL Error (Code: 400).
    prisma delete --force
    ran without error but doesn't seem to do anything I'm using 1.34.3 for both the CLI and server node 10.16.1 prisma.yml:
    Copy code
    endpoint: <http://xx.xxx.xx.xx:4466>
    datamodel: datamodel.prisma
    
    generate:
    	- generator: javascript-client
    		output: ./generated/prisma-client/
    docker-compose.yml:
    Copy code
    version: '3'
    services:
      prisma:
        image: prismagraphql/prisma:1.34
        restart: always
        ports:
        - "4466:4466"
        environment:
          PRISMA_CONFIG: |
            port: 4466
            # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
            # managementApiSecret: my-secret
            databases:
              default:
                connector: mysql
                host: >-
                 	someserver....
                database: dbname
                user: someuser
                password: somepassword
                rawAccess: true
                port: '3306'
                migrations: true
    I tried to remove docker container and image and re-installed everything. Still get the same issue. Please help. Thanks!
    h
    • 2
    • 3
  • b

    bbousque

    08/06/2019, 5:59 PM
    Hi im confused on the name identifier for prisma relationships can anyone specify what it's for and if I need it
  • c

    Christopher M

    08/06/2019, 6:30 PM
    hi all, new here. i have an existing db on graph.cool. What api code can I use to view the existing data model from types.graphql?
  • i

    Isaac Weber

    08/06/2019, 7:20 PM
    Are there any good resources on how Prisma handles a permission hierarchy?
  • r

    Ronnie Gauny

    08/06/2019, 9:31 PM
    Can I use prima on a Mysql DB in which I only have read access?....It keeps on wanting to create a "prisma" database........Can I set the host in which to create the "prisma" db?
    ⁉️ 1
    j
    • 2
    • 2
  • j

    Joseph

    08/07/2019, 2:59 AM
    I deleted all the tables in my database because my
    prisma deploy
    wasn't updating the String type to the specified Enum type. But now I'm getting errors about
    relation MY_TABLE doesn't exist
    because it's still trying to run migrations instead of set everything up. Is there a way to clear it's migration cache?
    j
    • 2
    • 6
  • t

    tmoney

    08/07/2019, 3:29 AM
    I’m just starting to find out that nexus-prisma is adding a massive amount of overhead to our queries. Up to 16 seconds in some cases
    j
    a
    • 3
    • 15
  • c

    Corey Snyder

    08/07/2019, 3:30 AM
    With a datamodel like this:
    Copy code
    type User {
        id: ID! @id
        name: String!
        email: String! @unique
        active: Boolean @default(value: false)
    }
    
    type EmailVerification{
        id: ID! @id
        verificationCode: String!
        user: User!
    }
    Is it possible to query for the email verification where
    user.email=test@example.com
    I’m trying to query it like this but it’s not working and I’ve tried a bunch of different versions to no avail
    Copy code
    let emailVerification = await context.prisma.emailVerifications({
            where:{
              user: {connect: {email: args.email}}
            }
          });
    • 1
    • 1
  • l

    Logan Lee

    08/07/2019, 3:47 AM
    Is it okay using Prisma like JPA(Java Persisnstance API)? prisma generate CRUD and subscriptions etc...automatically based on Info that I defined into “datemodel.prisma” Which mean is I don’t need to define other custom resolvers for using GraphQL. right? Local server port is on at 4000 and local prisma port is on 4466. Therefore I just can make a request to 4466 from Client instead of 4000 for db tasks? did I understand correctly?
    j
    • 2
    • 10
  • a

    Andros Wong

    08/07/2019, 5:59 PM
    Hey guys I'm wondering if https://github.com/prisma/prisma/issues/3846 will be solved pretty soon. Concurrency with Prisma is pretty hard to deal with - currently using 1.26.6 so if not I was wondering if there are ways to use raw sql queries
    t
    h
    • 3
    • 7
  • i

    iago

    08/07/2019, 8:06 PM
    not being able to
    { delete: true }
    through an optional back-link within an
    update
    , because it's only valid if it exists. should this be an issue?
    h
    • 2
    • 9
  • c

    Chad H

    08/08/2019, 2:47 AM
    Is the column type id: ID! @id guaranteed to be unique across all tables?
    j
    h
    • 3
    • 3
  • b

    Brad Goldsmith

    08/08/2019, 1:45 PM
    I get this error when I do `prisma deploy`:
    Copy code
    [WARNING] in /Users/bradgoldsmith/Desktop/Advanced-React/sick-fits/backend/prisma.yml: Invalid variable reference syntax for variable env.PRISMA_ENDPOINT. You can only reference env vars, options, & files. You can check our docs for more info.
    In my .yml file I reference my
    .env
    vars like this:
    endpoint: ${env.PRISMA_ENDPOINT}
    Any ideas?
    • 1
    • 1
  • c

    Corey Snyder

    08/08/2019, 2:53 PM
    @Harshit Is there a way to get the fully populated object with the child types populated on it so I don’t have to make a series of follow-up calls through
    Type Resolvers
    to get access to those Types? Example:
    Copy code
    type User {
        id: ID! @id
        name: String!
        email: String! @unique
        active: Boolean @default(value: false)
        updatedBy: User @relation(name: "EditedUser")
        updatedAt: DateTime @updatedAt
        password: String!
        links: [Link!]!
        votes: [Vote!]!
        flightControllers: [FlightController!]! @relation(name: "AddedFlightControllers")
        editedFlightControllers: [FlightController!]! @relation(name: "EditedFlightControllers")
        addedMerchants: [Merchant!]! @relation(name: "AddedMerchants")
        editedMerchants: [Merchant!]! @relation(name: "EditedMerchants")
        AddedFlightControllers: [FlightControllerMerchantLink!]! @relation(name: "AddedFlightControllerMerchantLinks")
        role: Role @default(value: USER)
        emailVerification: [EmailVerification] @relation(name: "UserEmailVerifications")
    }
    Now in my code I want to query for a user, and get all of the child types populated in my code. If I simply return the user, I’m able to query the child types just fine via GraphQL queries but if in my code I needed a list of the votes I have to re-run the query:
    context.prisma.user({ id: args.user.id }).votes()
    and if I wanted the links
    context.prisma.user({ id: args.user.id }).links()
    Is there a way to get this in 1 go?
    h
    • 2
    • 3
  • c

    Corey Snyder

    08/08/2019, 2:58 PM
    @Harshit When making queries such as
    context.prisma.user({ id: args.user.id })
    It appears that I can only do searches on certain fields, maybe ones marked as unique? Or maybe just IDs? If I try to run
    context.prisma.user({ email: '<mailto:corey@test.com|corey@test.com>' })
    prisma throws errors that email isn’t on the list of properties which can be searched. This requires me to instead use
    context.prisma.users({ where: {email: '<mailto:corey@test.com|corey@test.com>' }})
    which returns an array of items which I immediately have to get at the first item in the array like:
    Copy code
    let user = (await context.prisma.users({
            where: {
              email: args.email.toLowerCase(),
            }
          }))[0] <<-- this part kinda sucks..
    Am I doing this wrong? Is there a better way to go about it?
    h
    • 2
    • 4
  • t

    tmoney

    08/08/2019, 5:37 PM
    How do I query for a list where one of their relations is null? It looks like I am unable to correctly query for when a relation is
    null
    . I want it to return a list of nodes
    where
    the relationship is
    null
    . This worked fine in graphcool, but now it doesn’t seem to be the way that you need to do it in Prisma. Here’s my query:
    Copy code
    query getCompanyAndFees($companyId: ID!) {
    	Company: company(
    		where: {
    			id: $companyId
    		}
    	) {
    		id
    		fees(
    			where: {
    				isEnrollmentFee: true
    				tuitionServiceFeeForCompany: null
    			}, 
    			orderBy: name_ASC
    		) {
    			id
    			name
    			tuitionServiceFeeForCompany {
    				id
    			}
    		}
    	}
    }
    This query gives me back the following payload:
    Copy code
    {
      "data": {
        "Company": {
          "id": "cjac65ek0127b0",
          "fees": []
        }
      }
    }
    If I comment out this condition in the where clause:
    tuitionServiceFeeForCompany: null
    You can see I get back several fees where
    tuitionServiceFeeForCompany
    is
    null
    Copy code
    {
      "data": {
        "Company": {
          "id": "cjac65ek0127b0",
          "fees": [
            {
              "id": "cjaz34ym31hdi0,
              "name": "53 Books",
              "tuitionServiceFeeForCompany": null
            },
            {
              "id": "cjaz37nm71he7",
              "name": "CD & Flash Cards",
              "tuitionServiceFeeForCompany": null
            }
          ]
        }
      }
    }
    It should be getting back that last result without commenting out the
    tuitionServiceFeeForCompany: null
    h
    t
    • 3
    • 13
  • m

    Muhaki

    08/09/2019, 7:24 AM
    Hi Guys, i have a String in my schema, but i want it as VarChar in Postgres, how can i do that?
    h
    • 2
    • 3
  • k

    Khoa Le

    08/09/2019, 3:34 PM
    I would like to ask is where that I could deploy prisma + mongodb
  • k

    Khoa Le

    08/09/2019, 3:36 PM
    I'm currently using mongodb atlas + prisma for my local env and I would like to deploy the same stacks into digitalocean. Have anyone use the same stacks or some other opinions? Please give me some advises, my background is mainly front-end React so when it come to this I'm quite clueless.
1...298299300...637Latest