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

    Luke

    07/21/2019, 1:22 AM
    I have
    Copy code
    type User {
      id: ID! @unique @id
      updatedAt: DateTime! @updatedAt
      createdAt: DateTime! @createdAt
    in my schema but those fields are not being auto generated. When I create a new user they are empty. Do I need to explicitly set them? or can Prisma do that for me?
    n
    • 2
    • 1
  • s

    Sushmitha M Katti

    07/21/2019, 9:54 AM
    Hello everyone, which would be best hosting service to deploy prisma in terms of cost and speed?
    s
    s
    • 3
    • 4
  • a

    Anton

    07/21/2019, 12:38 PM
    Someone can give working example how connect Prisma to Mongo ? I followed docs and stuck running in error that cluster not found
  • b

    Bruce He

    07/21/2019, 4:02 PM
    Copy code
    import { inputObjectType, scalarType, objectType, asNexusMethod } from 'nexus'
    import { string } from 'yup';
    import { GraphQLUpload } from 'graphql-upload';
    
    import { GraphQLDate } from "graphql-iso-date";
    
    export const GQLDate = asNexusMethod(GraphQLDate, "date");
    
    export const CreateEventInput = inputObjectType({
      name: 'CreateEventInput',
      definition(t) {
        t.id('id', { required: true })
        t.string('name', { required: true })
      },
    })
    
    export const Upload = asNexusMethod(GraphQLUpload, "upload");
    
    
    export const UploadFileInput = objectType({
      name: 'UploadFileInput',
      definition(t) {
        t
      },
    })
    
    
    export const arrMutationInputs = [
      CreateEventInput,
      UploadFileInput
    ]
    Can any one help to to fiure out why scala types not find in my project event I have defined them. t.date or t.upload both not working
  • d

    Daniel Moos

    07/22/2019, 7:40 AM
    Is there any specific reason passing one prisma instance to the gql context instead of importing it individually? I'm asking because I might outsource heavier logic into different service files and I feel importing a prisma instance everytime is more convenient instead of passing the context-prisma-instance into each function
  • d

    Daniel Moos

    07/22/2019, 7:40 AM
    or is there any other best-practice solution around?=
  • t

    Taras Protchenko

    07/22/2019, 1:23 PM
    Json values are currently limited to 256KB in size. https://www.prisma.io/docs/datamodel-and-migrations/datamodel-POSTGRES-knum/#json How i can pass this limitation? I host my project by myself.
  • c

    Cameron

    07/22/2019, 1:59 PM
    Hey there. I’m looking for some help on a weird issue that I’m running into. I have a prisma datamodel with with two types like such:
    Copy code
    type User {
        id: UUID! @unique
        someField: TypeTwo @relation(name: "RelationName", onDelete: CASCADE)
    }
    
    type TypeTwo {
        id: UUID! @unique
        user: User! @relation(name: "RelationName")
    }
    My schema.graphql is:
    Copy code
    type User {
        id: UUID!
        someField: TypeTwo
    }
    
    type TypeTwo {
        id: UUID!
        user: User!
    }
    I have a query to get user information inside my Query resolvers:
    Copy code
    me: (parent, args, context) => {
        return context.prisma.user({ id: args.id })
    }
    The weird thing is when I run the query on the graphql playground it returns the someField value for User, but when I console.log the query on my express server, it shows every field for User except for someField. Data is being saved correctly inside my db (Postgres). The playgrounds for my server and client are consistent. I have another relation field on User as well, and I have the same issue. Does anyone know why this would be? I can provide more information if helpful. I’m using prisma 1.34.1 and graphql-yoga 1.17.0.
    n
    • 2
    • 1
  • o

    Osicka

    07/22/2019, 2:54 PM
    Hey all, maybe the wrong channel, but a good friend of mine has been working on his platform https://boolean.sh He also wrote a blog about it (https://boolean.sh/blog/why-feature-flags). Maybe it could help out someone and eventually him as well 😄
  • t

    thecrazyhoodie

    07/22/2019, 3:50 PM
    the examples are not there or something
  • t

    thecrazyhoodie

    07/22/2019, 3:50 PM
    https://github.com/prisma/photonjs/pull/28
    n
    • 2
    • 2
  • t

    thecrazyhoodie

    07/22/2019, 3:50 PM
    🤔
  • m

    macejmic

    07/22/2019, 4:58 PM
    guys, please i need a help: i have a generated
    roomsConnection
    , query looks like this:
    Copy code
    query{
      roomsConnection(where:{location:{id:"cjy5v86kx00ds0736x73fr63a"}}){
        edges{
          node{
            name
          }
        }
        pageInfo{
          endCursor
          startCursor
          hasNextPage
          hasPreviousPage
        }
      }
    }
    this works just fine, but i need to re-do the generated query and change it for a bit:
    Copy code
    export const roomsConnection = queryField('roomsConnection', {
      type: 'RoomConnection',
      async resolve(_parent, args:any, { prisma }) {
        const newReturn = {
          pageInfo: prisma.roomsConnection(args).pageInfo(),
          edges: prisma.roomsConnection(args).edges(),
          aggregate: prisma.roomsConnection(args).aggregate()
        }
        return newReturn
      }
    });
    the only thing that is missing is
    args
    , all
    where
    ,
    skip
    etc. arguments should be defined.. i’m trying re-use generated args with something like this:
    Copy code
    import { NexusGenArgTypes } from '../../generated/nexus';
    const reusedArgs: NexusGenArgTypes["Query"]["roomsConnection"] = {};
    and then use it within the custom resolver as:
    Copy code
    args: reusedArgs
    but it does not work.. anybody has an idea what to do? thanks a lot!
  • t

    thecrazyhoodie

    07/22/2019, 6:46 PM
    Curious if you guys will ever release the source code for your blog
  • t

    thecrazyhoodie

    07/22/2019, 6:47 PM
    :p it looks really nice and exactly the way I want.
  • a

    Andrés Villalobos

    07/22/2019, 6:50 PM
    ^ Agree, it would be nice learning case
  • k

    Krispin Leydon

    07/22/2019, 8:12 PM
    Hi, I'm testing out a prisma example (prisma-examples/docker-mysql). The server is up and running , but the _admin page appears to be hung:
  • k

    Krispin Leydon

    07/22/2019, 8:12 PM
    ...is this to be expected (since its still in beta) - or is something awry?
    s
    • 2
    • 2
  • y

    yuritoledo

    07/22/2019, 10:46 PM
    Hello guys! Can I host a prisma server on free tier prisma and typescript/express server on node? I need free host at beginning 😕
  • k

    Kenan Pulak

    07/23/2019, 12:34 AM
    Hey guys, I’ve been using Prisma for almost 6 months now (v1.26 ) as our PostgreSQL ORM and now that we’re getting ready to launch the product we want to hook up some admin panel software to our Prisma database called Forest Admin (https://docs.forestadmin.com/documentation/getting-started/installation). They use sequelize under the hood to connect to the Prisma database but since Prisma doesn’t have tables and just the schema (https://www.prisma.io/forum/t/where-is-prisma-1-8-data-saved-in-postgresql/3457) how can I leverage using them both interchangeably? Has anyone had experience with this in the past? I’d like to be able to use something out of the box for our admin panel so I don’t have to manage another project we would have to otherwise build from scratch.
    h
    l
    • 3
    • 2
  • i

    Igor Vuleta

    07/23/2019, 7:35 AM
    Hi there folks, I am relatively new in this, but want to ask for help/advice. Has anyone been in a situation to deal with alot of models that should be as a source to graphql types, I am speaking of the c# implementation but anyhow the prog. lang doesn't matter that much it's more of a concept in graphql. The thing is I have alot of models that should eventually have their counterparts in graphql types, but I cannot reassamble them to be separate microservices cause of huge db complexity, so is there a possibility to somehow generate a graphql schema with the types but in a dynamic fashion i.e. that I have a generic accessor in the schema which will only load me the types that I need and not all my actual schema?
    h
    • 2
    • 2
  • p

    Paul Hachmang

    07/23/2019, 7:40 AM
    Are there any plans to better support an event sourcing workflow? It shouldn’t be too hard to implement with the database subscriptions, but would be nice if there is some guidance what the best practices are
    h
    • 2
    • 2
  • k

    koufatzis

    07/23/2019, 7:56 AM
    Hello guys I have a question. How is it possible with prisma 1.33 to fetch records from a table including the foreign keys without resolving the relations? Just including the `id`s. I know that I can select fields using a fragment and I am doing exactly that but I am curious if that will produce a join despite that I am only interested in the foreign key
  • s

    swangy

    07/23/2019, 10:40 AM
    hi, trying to use prisma on a new project since i’ve been hearing lots of good things from it… have been running into several hurdles.
    h
    • 2
    • 1
  • s

    swangy

    07/23/2019, 10:41 AM
    - how do you batch insert an array of objects? without resorting to looping through bunch individual calls?
  • k

    Krispin Leydon

    07/23/2019, 6:13 PM
    Will Prisma2 include a DataLoader, configured to combine queries (where possible) out of the box? Or will an add-on be required to accomplish this? Thanks!
    h
    • 2
    • 1
  • k

    koia

    07/23/2019, 6:16 PM
    Has Prisma being downgraded?: this is the output of
    npm view prisma
    Copy code
    prisma@1.30.5 | Apache-2.0 | deps: 5 | versions: 694
    Prisma is a realtime GraphQL database layer. Connect directly from the frontend or build your own GraphQL server.
    <https://github.com/prisma/prisma>
    
    keywords: prisma, graphql, backend, deployment, api, server
    
    bin: prisma
    
    dist
    .tarball: <https://registry.npmjs.org/prisma/-/prisma-1.30.5.tgz>
    .shasum: 3c01c984b31540f3b8c8495aeadb06dabe4ecc6b
    .integrity: sha512-tZ1tFqF8nja8pUAhfvkFpo4z1Oee8vo1n5Ip3S3BqRiocaau6h9LY+xoSwHTHmmCmu7/Yv0reNyE5B6gkZ1W1g==
    .unpackedSize: 27.3 kB
    
    dependencies:
    fs-extra: ^7.0.0            prisma-cli-engine: 1.30.5   source-map-support: ^0.4.18 
    prisma-cli-core: 1.30.5     semver: ^5.4.1              
    
    maintainers:
    - schickling <schickling.j@gmail.com>
    - timsuchanek <tim.suchanek@gmail.com>
    
    dist-tags:
    alpha: 1.36.0-alpha.11        changelog: 1.9.0-changelog.1  test: 1.24.0-test.5           
    beta: 1.35.0-beta             latest: 1.30.5
  • k

    koia

    07/23/2019, 6:17 PM
    It says that the latest version it's 1.30.5... Where did 1.34 go?
  • k

    koia

    07/23/2019, 6:23 PM
    The 1.34 still there:
    Copy code
    ~ → npm info prisma versions | grep 1.34
      '1.33.0',            '1.34.0-alpha.1',   '1.34.0-alpha.2',
      '1.34.0-beta',       '1.34.0-beta.1',    '1.34.0',
      '1.34.1',            '1.34.2',           '1.35.0-alpha.1',
    But why is it pulling the 1.30.5 version as the latest? @tim2
    e
    t
    b
    • 4
    • 9
  • k

    koia

    07/23/2019, 6:34 PM
    ?????? @tim2
1...294295296...637Latest