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

    Simskii

    11/27/2019, 6:31 PM
    Cloudformation for prisma server with multiple containers. Is there one?
  • r

    Robert Hall

    11/28/2019, 2:26 AM
    Would someone know if it's expected to not see custom directives show up on the Schema or Docs tab of Playground?
    j
    • 2
    • 1
  • m

    Mohsin Raza

    11/28/2019, 6:34 AM
    when i run "prisma deploy" it says: ERROR: No cluster could be found for workspace '*' and cluster 'default' { "data": { "generateClusterToken": null }, "errors": [ { "message": "No cluster could be found for workspace '*' and cluster 'default'", "locations": [ { "line": 3, "column": 9 } ], "path": [ "generateClusterToken" ], "code": 222 } ], "status": 200 }
  • m

    Mohsin Raza

    11/28/2019, 6:34 AM
    can anybody help me out ?
  • m

    Mohsin Raza

    11/28/2019, 6:35 AM
    prisma deploy is not working after adding secret in prisma.js
  • i

    Indrek Lasn

    11/28/2019, 10:06 AM
    @Mohsin Raza Can you show the
    prisma.js
    file?
  • f

    Faraaz Nishtar

    11/28/2019, 1:41 PM
    👋 all. I’m setting up Prisma for the first time and I’m unable to get my generated Prisma Queries/Mutations and my custom resolvers from the same endpont. My directory structure:
    Copy code
    datamodel.graphql
    package.json
    prisma.yml
    src
      generated
      index.ts
      resolvers.ts
      schema.graphql
    My
    prisma.yml
    Copy code
    endpoint: <http://localhost:4666>
    datamodel: datamodel.graphql
    
    generate:
      - generator: typescript-client
        output: ./src/generated/prisma-client/
    My GraphQL Yoga server
    index.ts
    Copy code
    import { GraphQLServer } from 'graphql-yoga'
    import { prisma } from './generated/prisma-client'
    import { resolvers } from './resolvers'
    
    const server = new GraphQLServer({
      typeDefs: './src/schema.graphql',
      resolvers,
      context: { prisma },
    })
    
    server.start(() => console.log('Server is running on <http://localhost:4000>'))
    When I go to my Prisma Engine Playground on
    <http://localhost:4466>
    I can see all of the Prisma generated Queries. And when I start my server on
    <http://localhost:4000>
    I only see my custom resolvers. How can I get it so that both my custom resolvers and the Prisma generated queries are available? Been banging my head on this one for a while. Hoping someone more experienced might know what’s going on?
    j
    • 2
    • 11
  • j

    JamesJ

    11/28/2019, 1:45 PM
    Hi I am using Prisma 1.34.8 and have a scenario where I am connecting to a 3rd party and need to proceed through a few back and forth request/response steps for a task. As part of this the 3rd party wants to send a packet of data directly to the backend. As this doesn’t go through the graphql-yoga server, but rather will hit an endpoint setup directly with express.use I am wondering how I can make a direct database query to update a record. I checked the docs and saw ‘Raw Database Access (coming soon)’ so am thinking that’s the way to achieve this. However, perhaps I should consider an alternative strategy? Does anyone have any advice with this sort of scenario? Thanks
    l
    • 2
    • 4
  • i

    Indrek Lasn

    11/28/2019, 7:56 PM
    @Max Tayebwa Could you give us more info on the issue, please? :-)
  • f

    florian

    11/29/2019, 1:45 AM
    Hi, I'm using
    prisma-binding
    and I would like to retrieve the
    updatedAt
    field from an update query, unfortunately it seems not possible, i get the following :
    Field "updatedAt" is not defined by type [TypeName]UpdateInput.
  • f

    florian

    11/29/2019, 1:45 AM
    Anyone found a work around this ?
  • f

    florian

    11/29/2019, 1:48 AM
    (Note that the updatedAt field is declared as
    updatedAt: DateTime! @updatedAt
    in Prisma's datamodel)
  • r

    Raeesaa

    11/29/2019, 12:45 PM
    Hi, I am using Prisma 1.30 and need help with one use-case. We are using
    contains
    for querying data with substring and it looks like if search term has special characters, it does not give expected result. For example, I created test table with
    name
    fields set to
    demo
    ,
    test_data
    and
    data
    and when we fire query as
    name_contains: "t_"
    , it returns records with name as
    test_data
    as well as
    data
    . Is there anyway to escape special characters while using
    contains
    ?
  • l

    Luca Corsilli

    11/29/2019, 2:52 PM
    Hello there! I'm just trying to do a
    prisma deploy
    using the Demo server and I get this error:
    Copy code
    $ prisma deploy                                                                                                                                                                             
    ? Set up a new Prisma server or deploy to an existing server? Demo server + MySQL database
    Authenticating !
    
    ERROR: GraphQL Error (Code: 400)
    
    {
      "error": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n<TITLE>ERROR: The request could not be satisfied</TITLE>\n</HEAD><BODY>\n<H1>400 ERROR</H1>\n<H2>The request could not be satisfied.</H2>\n<HR noshade size=\"1px\">\nBad request.\nWe can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website 
    owner.\n<BR clear=\"all\">\nIf you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.\n<BR clear=\"all\">\n<HR noshade size=\"1px\">\n<PRE>\nGenerated by cloudfront (CloudFront)\nRequest ID: cz85zoi76LETgNaFLeznNOJyPDLGPUp3N1lz1HwoVk6xkhAA8GrjJA==\n</PRE>\n<ADDRESS>\n</ADDRESS>\n</BODY></HTML>",
      "status": 400
    }
    
    Get in touch if you need help: <https://slack.prisma.io>
    To get more detailed output, run $ export DEBUG="*"
    I'm behind a corporate proxy and I did export both
    HTTP_PROXY
    and
    HTTPS_PROXY
    envs in my System (and User) environment in Windows. What am I doing wrong?
  • k

    kitze

    11/29/2019, 7:35 PM
    anyone from customer support here?
  • w

    Wesley Schleumer de GĂłes

    11/29/2019, 7:39 PM
    hey devs, i'm looking prisma2, and i have an question, it's about the model definition, will there be a way to create a model called
    User
    that links to a table called
    users
    ? On prisma1 i could do this with the
    @db(name: 'users')
    but this does not apply to prisma2.
  • c

    Christopher Ayling

    11/29/2019, 11:15 PM
    Hey folks, I'm just learning prisma (and coding in general) and I was looking for some help, I hope it's ok to ask here. I'm trying to set up my data model for an event website. Users can post events, but they can also search for and follow many other events (made by other users) in order to get updates about the events they've followed. I've set up my schema as follows, but I don' think it's correct: type User { id: ID! @id name: String! @unique email: String! @unique password: String! createdAt: DateTime! @createdAt followedEvents: [Event]! } type Event { id: ID! @id title: String! description: String! startTime: DateTime! endTime: DateTime! user: User! } I was hoping that followedEvents: would just be a list of events they've followed. When I do this, all the events a person makes show up as their followedEvents, and if I remove an event from a users followedEvents it remoes the user who created that event from the Event itself. Should I just store an array of event ID's? or is there a way to make a relationship? Sorry for what is probably a very basic question and thanks for your time and help.
    r
    • 2
    • 4
  • k

    kitze

    11/30/2019, 7:23 AM
    Is there a way to get a correct TS type when using
    $fragment
    ?
  • a

    Ahmet

    11/30/2019, 2:18 PM
    I couldn’t deploy to prisma. Errors:
    Copy code
    Error: The Migration failed and has not been performed. This is very likely not a transient issue.
    org.postgresql.util.PSQLException: ERROR: column “content” of relation “Message” already exists
      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)
      at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)
      at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)
  • m

    Marton Langa

    11/30/2019, 3:10 PM
    could you migrate locally?
  • m

    Michael Cheng

    11/30/2019, 9:21 PM
    Does Pagination work with orderBy? I'm trying this:
    Copy code
    query($sort: TagOrderBy!, $first: Int!, $after: String) {
        allTags(orderBy: $sort, first: $first, after: $after) {
    But it doesn't seem to be respecting the
    orderBy
    . I'm getting duplicate items in the
    fetchMore
    result.
  • j

    James David Bradly Carballo

    12/01/2019, 2:43 AM
    Hi guys can someone help me? I just can't seem to make my nested queries work even thought the schema, datamodel, and the resolvers seem syntactically correct
  • j

    James David Bradly Carballo

    12/01/2019, 2:45 AM
    I'm just really desperate :((
  • j

    James David Bradly Carballo

    12/01/2019, 2:48 AM
    here's my datamodel.prisma
    Copy code
    type Condominium @db(name: "condominium") {
      id: UUID! @id
      amenities: Float
      cbd: String
      city: String
      condoName: String! @db(name: "condo_name")
      developerName: String @db(name: "developer_name")
      launchDate: String @db(name: "launch_date")
      location: String
      lotAreaSqm: Float @db(name: "lot_area_sqm")
      marketPositioning: Float @db(name: "market_positioning")
      meltedMps: [MeltedMp] @relation(name: "CondoMeltedmp")
      noOfFloors: Int @db(name: "no_of_floors")
      turnover: Float
    }
    
    type Cost @db(name: "cost") {
      id: Int! @id(strategy: SEQUENCE) @sequence(name: "cost_id_seq", initialValue: 1, allocationSize: 1)
      costLevel: String @db(name: "cost_level")
      year2015: Int @db(name: "year_2015")
      year2016: Int @db(name: "year_2016")
      year2017: Int @db(name: "year_2017")
      year2018: Int @db(name: "year_2018")
      year2019: Int @db(name: "year_2019")
    }
    
    type MeltedMp @db(name: "melted_mp") {
      id: Int! @id(strategy: SEQUENCE) @sequence(name: "melted_mp_id_seq", initialValue: 1, allocationSize: 1)
      condo: Condominium! @relation(name: "CondoMeltedmp")
      computes: String
      data1br: Float @db(name: "data_1br")
      data2br: Float @db(name: "data_2br")
      data3br: Float @db(name: "data_3br")
      data4br: Float @db(name: "data_4br")
      data5br: Float @db(name: "data_5br")
      others: Float
      quarter: String
      studio: Float
      year: Int
    }
    here's my schema.graphql:
    Copy code
    # import Condominium from './generated/prisma.graphql'
    # import MeltedMp from './generated/prisma.graphql'
    
    
    type Query {
      condominiums: [Condominium!]!
      condominium(id: UUID!): Condominium
      getAllMps: [MeltedMp!]!
      getOneMp(id: Int!): MeltedMp!
    
    }
    
    type Condominium {
      id: UUID!
      amenities: Float
      cbd: String
      city: String
      condoName: String!
      developerName: String
      launchDate: String
      location: String
      lotAreaSqm: Float
      marketPositioning: Float
      noOfFloors: Int
      turnover: Float
      meltedMps: [MeltedMp!]
    }
    
    type MeltedMp {
      id: Int!
      computes: String
      condo: Condominium!
      data1br: Float
      data2br: Float
      data3br: Float
      data4br: Float
      data5br: Float
      others: Float
      quarter: String
      studio: Float
      year: Int
    }
    While here is my index.js:
    Copy code
    const { GraphQLServer } = require('graphql-yoga')
    const { prisma } = require('../prisma/generated/prisma-client')
    
    const resolvers = {
      Query: {
        condominiums: (_, args, context) => {
          // ...
          return context.prisma.condominiums()
        },
        condominium: (_, {id}, context) => {
            return context.prisma.condominium(
                {
                    id
                }
              )
        },
        getAllMps: (_, args, context) => context.prisma.meltedMps(),
        getOneMp: (_, {id}, context) => prisma.meltedMp(
            {
                id
            }
          )
      },
      Condominium: {
        meltedMps: parent => {
          return prisma.condominium({id: parent.id}).meltedMps()
          },
        id: (parent, args, context) => parent.id
        },
    
     }
    
    const server = new GraphQLServer({
      typeDefs: 'src/schema.graphql',
      resolvers,
      context: { prisma }
    })
    server.start(() => console.log(`GraphQL server is running on <http://localhost:4000>`))
    l
    l
    • 3
    • 11
  • r

    rein

    12/01/2019, 1:05 PM
    does it make sense to still set up a prisma1 project? Or is it better to just wait for prisma2. One thing that is really worrying me is the fact that migration from 1 to 2 will be pretty difficult since prisma2 does not have the same relay-type api (nodes, edges, ...) as Prisma1 one provides.
    j
    t
    g
    • 4
    • 5
  • s

    s.b

    12/01/2019, 6:14 PM
    Does anybody know if Prisma is going to support Dynamodb in future ?
  • e

    Eric Reis

    12/02/2019, 5:43 AM
    Is there anywhere we can see if specific db features have already been implemented on prisma2? Things like json field, check constraint, aggregates.
  • b

    Ben

    12/02/2019, 7:48 AM
    Hi! Prisma tokens have an expiration date (so it says in the RFC of the JWT). What is the default expiration date? Is there any way I can influence the expiration date?
    l
    • 2
    • 3
  • l

    Lasse Abelsen

    12/02/2019, 12:44 PM
    Hi Everyone. I have a question regarding query -> sql statement translation. Say that we have a model with the following:
    Copy code
    type Person  
    {
    txPrimaryKey: String @unique
    id: ID! @id
    PersonName: [PersonName]  @relation(name:"Person_PersonName")
    }
    and
    Copy code
    type PersonName  
    {
    txPrimaryKey: String @unique
    id: ID! @id
    givenName: String
    surname: String
    Person: Person @relation(name:"Person_PersonName")
    }
    Where we query person:
    Copy code
    query {
      person(where: { txPrimaryKey: "morethan26characters1234567890" }) {
        genderCode
        PersonName {
          surname
          givenName
        }
      }
    }
    That query will be translated to the following:
    Copy code
    select 
      ""default$default"".""Person"".""id"", 
      ""default$default"".""Person"".""genderCode"", 
    from ""default$default"".""Person""
    where ""default$default"".""Person"".""txPrimaryKey"" = $1","parameters: $1 = 'morethan26characters1234567890'"
    Plus:
    Copy code
    select 
      "Alias"."surname", 
      "Alias"."givenName", 
      "Alias"."id", 
      "RelationTable"."id" as "__RelatedModel__", 
      "RelationTable"."Person" as "__ParentModel__"
    from "default$default"."PersonName" as "Alias"
      join "default$default"."PersonName" as "RelationTable"
      on "Alias"."id" = "RelationTable"."id"
    where "RelationTable"."Person" in ($1)
    order by "RelationTable"."id" asc
    As you can see, the query turns into two statements, the last one selecting from PersonName and then joining it with.. PersonName (and also performed an expensive order by) We're using prisma image 1.34 and postgres 11. Any pointers appreciated.
    r
    • 2
    • 2
  • j

    Jahmiamor

    12/02/2019, 2:37 PM
    hey..when i create a type in my datamodel.graphql, whether it be a type User or type Item..the queries that generate in my prisma.graphql file does not include a query to for a singular user or item, only users & items. is anyone else having this issue?
    • 1
    • 1
1...336337338...637Latest