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

    abanoub essam

    05/03/2020, 8:34 AM
    how to upload files on the playground of graphql-yoga ?
    r
    • 2
    • 1
  • s

    Simon Edelmann

    05/03/2020, 10:42 AM
    Hi there, I deployed a small application to serverless Vercel NOW (formerly Zeit NOW) using Prisma 2 and a postgres database on Heroku. Unfortunately the application is incredible slow when using the database. As this sounds as a common configuration, are there any hints how to improve? Thanks in advance!
    r
    • 2
    • 1
  • b

    blocka

    05/03/2020, 12:27 PM
    I'm trying to get the prisma vscode plugin working, but not having much success. I created a file
    .graphqlconfig
    and placed into it
    Copy code
    {
      "projects": {
        "ui": {
          "schemaPath": "api/graphql/schema.graphql"
        }
      }
    }
    Now in one of .ts files I have
    Copy code
    import gql from 'graphql-tag'
    
    export default gql`
      
    `
    but I get no autocomplete, error reporting, etc. in there
  • b

    blocka

    05/03/2020, 12:27 PM
    what am I missing?
  • d

    Dexter Marks-Barber

    05/03/2020, 2:08 PM
    Hey all 👋 I've been having a mess with the heroku server creation. But I can only seem to create a server for my personal account on heroku. Is it not possible to create one for my heroku team?
    r
    • 2
    • 3
  • t

    Taylor

    05/03/2020, 3:30 PM
    Is it possible to have two projects pointing to the same database - one using Prisma, the other using Mongoose? Because right now, I cannot seem to get it to work.
    r
    j
    r
    • 4
    • 4
  • j

    James Fox

    05/03/2020, 4:24 PM
    I’m upgrading my app from
    prisma2@2.0.0-alpha.538
    ➡️
    @prisma/cli@2.0.0-beta.1
    . My code compiles, but when I execute a simple query at
    <http://localhost:8000/graphql>
    , the request hangs forever with this in the server output:
    Copy code
    prisma:info  Starting a postgresql pool with 9 connections.
    prisma:info  Started http server on 127.0.0.1:51807
    r
    • 2
    • 2
  • e

    Eric McKay

    05/03/2020, 4:35 PM
    Hi there. Sorry in advance if this is an FAQ -- searched through the github issues and couldn't find anything about this. I want to write a query that finds all posts that have more comments than likes. Is this possible without using
    prisma.raw
    ? E.g:
    Copy code
    prisma.posts.findMany({ where: { comments: { gt: prisma.field('likes') } } })
    👍 1
    a
    r
    • 3
    • 4
  • j

    James Fox

    05/03/2020, 8:17 PM
    If I had a 1:1 model relationship working in the alpha client, is there a way to migrate to the beta client (where it’s necessary to use
    @relation(fields: [brand_id], references: [id])
    ) without data loss?
    Copy code
    model Product {
      id            String  @id
      brand         Brand?  @relation(fields: [brand_id], references: [id])
      brand_id      Int? <---- CAN I ADD THIS WITHOUT DATA LOSS?
    }
    
    model Brand {
      id          String  @id
    }
  • a

    Adriano Resende

    05/03/2020, 9:38 PM
    Hi there, the command
    prisma.$exists
    exist for version 2? To return boolean
    a
    • 2
    • 1
  • s

    Sebastien La Duca

    05/03/2020, 9:57 PM
    how do you deal with merge conflicts in
    migrate.lock
    ? it says to run
    prisma migrate fix
    but it says the command doesn’t exist when I try
    r
    • 2
    • 4
  • a

    Ashiqur Rahman

    05/04/2020, 12:25 AM
    is there any way to customize the prisma id? for example, all users id should starts with user... all posts id should starts with posts...
    r
    • 2
    • 1
  • t

    TEMILOLUWA OJO PHILIP

    05/04/2020, 3:17 AM
    hi guys, please has anyone ever implemented a follower/following feature in prisma, the prisma docs on self relationship isn't sufficient enough.
  • t

    TEMILOLUWA OJO PHILIP

    05/04/2020, 3:18 AM
    hi guys, please has anyone ever implemented a follower/following feature in prisma, the prisma docs on self relationship isn't sufficient enough.
  • n

    Nischal

    05/04/2020, 6:35 AM
    is there a seperate channel for prisma beta that i can be added into
    u
    • 2
    • 2
  • k

    Kennedy Otieno

    05/04/2020, 7:16 AM
    Hi all... A little help here: I had Prisma bootsrap my DB (it's Postgres running as a container). The data is there, I can read/write via Prisma JS Client... However, I'd like to attach another service to the DB... Now when I go to list tables on the database created, Postgres shows :
    Copy code
    coolestdb=# \d
    Did not find any relations.
    coolestdb=# \dt
    Did not find any relations.
    coolestdb=#
  • k

    Kennedy Otieno

    05/04/2020, 7:17 AM
    Am I looking in the wrong db? Here's a sample Prisma config on Docker-Compose:
    Copy code
    prisma:
            image: prismagraphql/prisma:1.34
            container_name: prisma
            restart: always
            ports: 
                - 4466:4466
            environment:
              SLOW_QUERIES_LOGGING: 'true'
              SLOW_QUERIES_LOGGING_THRESHOLD: '0'
              PRISMA_CONFIG: | 
                managementApiSecret: CANTH@CKTH1S
                port: 4466
                databases:
                  default:
                    database: coolestdb
                    connector: postgres
                    host: postgres
                    port: 5432
                    user: coolestdb
                    password: coolestpassword
                    connectionLimit: 3
            networks:
                - internal
                - web
    r
    • 2
    • 1
  • s

    saketh kumar

    05/04/2020, 7:19 AM
    Hi i was trying to do something like this in my USER. In order to achieve some sort of friend request process but i was getting an error as shown below the data model. Please help me out on this type USER { friends: [User!]! @scalarList(strategy: RELATION) sent: [User!]! @scalarList(strategy: RELATION) received: [User!]! @scalarList(strategy: RELATION) } Error: User ✖️ The relation field
    friends
    must specify a
    @relation
    directive:
    @relation(name: "MyRelation")
    ✖️ The relation field
    sent
    must specify a
    @relation
    directive:
    @relation(name: "MyRelation")
    ✖️ The relation field
    received
    must specify a
    @relation
    directive:
    @relation(name: "MyRelation")
    r
    • 2
    • 2
  • j

    jt

    05/04/2020, 5:32 PM
    is it possible to delete an item in a database as soon as it is disconnected from its relation? I'm trying to avoid checking for which items need to be deleted inside my mutation and simply let prisma handle the deletion automatically.
    p
    d
    • 3
    • 7
  • a

    Andrew Peterson

    05/04/2020, 7:11 PM
    Hey everyone, I’m working on an app that stores waypoints in an array, and I really need the array to be indexed. The array can be different lengths, have a few waypoints up to 50 say. I’m using Prisma (1.34) with a Postgres db. I haven’t found anything searching the official docs or usual websites....but, could be googling the wrong terms. It’s important for me to reliably be able to cycle through the array, as well as search that a waypoint is in a specific order...any help would be hugely appreciated!
  • p

    prisma-chobo

    05/04/2020, 7:36 PM
    hello is there any way i can do int id autoincrement in datamodel.prisma file? i triyed id: Int @id @default(autoincrement()) but i get this error: Syntax error while parsing GraphQL query. Invalid input “{\n id: Int @id @default(autoincrement(“, expected ImplementsInterfaces, DirectivesConst or FieldDefinitions
    r
    • 2
    • 2
  • j

    jt

    05/04/2020, 11:53 PM
    Is it possible to return the IDs of items that have been 'disconnected' from their relation inside a mutation?
  • i

    inlightmedia

    05/05/2020, 3:30 AM
    Does anyone know how to use a different port than 4466 for a prisma docker container? I need to run a testing environment that is running prisma and I need it to use a different port.
    c
    r
    • 3
    • 2
  • l

    Lars-Jørgen Kristiansen

    05/05/2020, 10:57 AM
    I have two models like this:
    Copy code
    type User {
      id: ID! @id
      todos: [Todo!]!
    }
    
    type Todo {
      id: ID! @id
      author: User! @relation(type: TABLE)
    }
    How can i migrate to
    INLINE
    without loosing data? Prisma 1 question btw..
  • n

    Nicolò

    05/05/2020, 11:40 AM
    Hi guys I'm using Prisma1 and i'm tring to get the foreign key of a relation. Take the basic example of Post and User.
    type User {
    id: ID! @id
    name: String!
    posts: [Post!]!
    }
    type Post {
    id: ID! @id
    title: String!
    published: Boolean! @default(value: false)
    author: User @relation(link: INLINE, "PostAuthor")
    }
    If I query the post I would like to have the id of user so I can then use it directly from a second level resolver.
    const posts = await db.posts()
    Its a 1:n relation so the key is stored on the Post entity. With SQL it would be a simple
    select *
    And yes we will migrate away from prisma1 but for now we have to fix current not working stuff.
    d
    • 2
    • 8
  • p

    Peter Albert

    05/05/2020, 1:28 PM
    Hi! We have a very strange issue in Prisma v1: one resolver runs for a very long time (running a bulk import). After a few minutes, the resolver is stared a second time - without any new request - and while the initial request is still being processed! Did anyone experience this, too? Any way to prevent this? Thanks
  • m

    Mickaël Oth

    05/05/2020, 1:54 PM
    Hello there, I'm new here and got a (probably) dumb question. I want to update a user with his ID (unique) and workspace (not unique, to verify if the user making this request has the same workspace in his token). So I'm making a where
    { id: 1, workspace: 1 }
    , but got an error because we can only update where with "UniqueInput" keys. I guess this is not a bug but a choice, but is there any workaround to do what I want ?
    m
    r
    • 3
    • 6
  • c

    chris meurer

    05/05/2020, 5:00 PM
    Hi all, in prisma 1 with apollo gql and gql shield can anyone think of a way to change the createdAt value of an entry in the db? I've tried executeRaw but gql shield blocks the call since it isnt in my schema. Trying to do some testing based on the createdAt date of an entry, but need to change it to more than 90 days ago. Thanks
  • y

    Yasir Hussain

    05/06/2020, 12:40 AM
    Hello everyone, I want to implement type resolver for "photo" filed for my "Student" model, searched some prisma docs and forum question but can't get anything to work me. I dont know how to get ID of ImageFile record to access it. What I am doing wrong where.
    Copy code
    type Student {
      id: ID! @id
      createdAt: DateTime! @createdAt
      name: String!
      email: String! @unique
      password: String!
      phone: String
      photo: ImageFile @relation(name: "PhotoToFile")
      coverPhoto: ImageFile @relation(name: "CoverPhotoToFile")
      bio: String
      dob: DateOfBirth
      gender: Gender! @default(value:OTHER)
      role: Role! @default(value:STUDENT)
      address: String
      classRoooms: [ClassRoom!]
      socialLinks:[SocialLink!]}
    Copy code
    type ImageFile {
       id: ID! @id
       assetId: String!
       publicId: String!
       url: String!
       secureUrl: String!
     }
    and my type resolver:
    Copy code
    const Student = {
      async photo(parent, args, { prisma }, info) {
        return prisma.query.student({ where: { id: parent.id } }).photo();
      },
    };
    
    module.exports = Student;
    Error:
    c
    s
    • 3
    • 5
  • y

    Yasir Hussain

    05/06/2020, 12:42 AM
1...370371372...637Latest