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

    Andreas Groos

    06/06/2020, 1:04 PM
    Hi all, trying to deploy my typescript graphql server to 
    heroku
    . Builds fine locally. Fails when I do 
    git push heroku master
     . The same happens when I clone the typscript graphql in the 
    examples
     repo, it fails to deploy with the same error message. After heroku runs  
    npm run generate
     it can't find 
    model
     , line 134+ Any tips?
    Untitled
    r
    • 2
    • 2
  • p

    Philipp Rajah Moura Srivastava

    06/06/2020, 4:26 PM
    So I’m trying to handle Prisma API errors in case they occur. I’ve followed this tutorial: https://dev.to/andre/handling-errors-in-graphql--2ea3 despite it being in typescript (I’m working in JS). Everything has worked besides the helmet, I’ve implemented the helmet resolver the same way, but when I pass the resolver into the helmet resolver it returns an empty query, if it’s not wrapped in helmet it works. getSchools: (parent, args, context, info) => helmet(getSchools(parent, args, context, info)) any help would be appreciated, Thanks
  • a

    Alejandro Sanchez

    06/06/2020, 6:22 PM
    how I can integrate Stripe using Prisma? Can I have in the server folder code to Process the payment?
    r
    • 2
    • 1
  • c

    Corey Snyder

    06/06/2020, 6:53 PM
    Prisma 1 Question - Does anyone know if there’s a way to add a “DELETE hook”. What I mean by this, is if an row in my
    Images
    table is deleted, I want a script to be kicked off to make a call to my AWS Lambda image service to remove that item from S3 bucket so I’m not storing an image with no references. Obviously I can write some logic around this and add it to every place which may cascade into row being removed from Images but it would be a lot easier if I could just hook into it somehow. Thanks!
    r
    • 2
    • 2
  • c

    Corey Snyder

    06/07/2020, 1:55 AM
    Does anyone have any example of unit testing code using prisma? Any good example code you can share of stubbing out things like
    context.prisma.product({ id: args.id })
  • c

    Corey Snyder

    06/07/2020, 2:22 AM
    With this
    datamodel.prisma
    Copy code
    type Product{
      id: ID! @id
      images: [Image] @relation(onDelete: CASCADE)
    }
    When this is called, would you expect the images to all be deleted for that product?
    Copy code
    await context.prisma.deleteProduct({ id: args.id })
    Because that’s totally not what’s happening. Images rows are being left hanging with nothing linking to them.
    r
    • 2
    • 1
  • d

    Daniel Park

    06/07/2020, 2:31 AM
    hey guys, excited to try out prisma. seems like exaclty what i was looking for
    💯 1
    prisma green 1
  • d

    Daniel Park

    06/07/2020, 2:31 AM
    would like to hear about anyone’s experience using this with postgres
    m
    • 2
    • 4
  • s

    Samet

    06/07/2020, 9:06 AM
    Hello everyone. I need some guidance! I need to create 4 level deep nested table schema:
    Company -> Service -> Specialty -> Sub-Specialty
    Each table will have only unique records. I tried creating a relations table but couldn't figure it out. How can I create this structure? Here is the datamodel I have right now:
    Copy code
    type Company {
      id: ID! @id
      name: String! @unique
    }
    type Service {
      id: ID! @id
      name: String! @unique
      companies: [Company]! @relation
      specialties: [Specialty] @relation
    }
    
    type Specialty {
      id: ID! @id
      name: String! @unique
      companies: [Company]! @relation
      services: [Service] @relation
      sub_specialties: [Specialty] @relation
    }
    s
    • 2
    • 6
  • g

    Gabriel Benson

    06/07/2020, 11:59 AM
    Is it possible to implement a multiple-column unique constraint (multi-column primary key) in Prisma's datamodel?
    r
    • 2
    • 3
  • d

    Daniel Gustaw

    06/07/2020, 6:48 PM
    @Meow I have version od mysql "8.0.19" and using introspection https://www.prisma.io/docs/reference/tools-and-interfaces/introspection everything works.
  • a

    Alejandro Sanchez

    06/08/2020, 2:16 AM
    Hi, I am trying to upload images and I have the following issue:
    “operationName”:“singleUpload”,“variables”:{“file”:null}
    r
    • 2
    • 31
  • a

    Alejandro Sanchez

    06/08/2020, 7:11 AM
    If someone could provide an image upload example in the server side using Prisma 1.3 and Graphql-yoga, I appreciate it
    g
    • 2
    • 2
  • l

    Logan Lee

    06/08/2020, 3:26 PM
    Hello 🙂 i would like to know that is multiple create possible?
    r
    • 2
    • 4
  • a

    Alejandro Sanchez

    06/09/2020, 5:35 AM
    I am having the following issue with upload images:
    Cannot destructure property 'createReadStream' of 'file' as it is undefined.
    a
    f
    • 3
    • 8
  • a

    Arthur Hirel

    06/09/2020, 6:59 AM
    Hello, I'm really sorry to use the general channel to say that but the use of prisma has really been a nightmare for me for the last few months and it almost impossible to speak to someone from the team. I have ha big issues with the Prisma 1 migration tool and have been stuck with a test database that I cannot migrate elsewhere since september. Can you help me please? I loved Prisma and used it in several projects, but now it has really become a technical nightmare...
    j
    h
    • 3
    • 15
  • w

    Will

    06/09/2020, 11:14 AM
    I'm attempting to connect prisma to a postgres database.. on the latest version of prisma, I get no output what so ever. I downgrated to 1.12 and prisma can't connect to my postgres database hosted on heroku.. I'm able to connect to this instance from Adminer from the same laptop.. any idea why prisma can't connect? I've tried with SSL Yes and No, and results are same regardless of what I choose.
    r
    • 2
    • 4
  • a

    ArcticSpaceFox

    06/09/2020, 12:06 PM
    Anybody know if there is a Rust Client coming ?
    r
    • 2
    • 2
  • o

    Omar Nasr

    06/09/2020, 1:49 PM
    Hey all, does anyone have experience migrating a production prisma 1 project to prisma 2 and have any blogs articles or experiences in general that are not reflected in the docs and can share. This would be immensely helpful to me and others I’m sure. Currently having a tough time deciding whether or not I should upgrade and wanting more insight on the experience of doing so.
    ➕ 1
    n
    • 2
    • 2
  • s

    sourabh

    06/09/2020, 4:11 PM
    Hi all, I am trying to create Prisma 2 + Nexus based application docker. Are there any examples availbale to see any example docker files for this ? I am using introspection mode of prisma to update the schema
    r
    • 2
    • 4
  • c

    cfree

    06/09/2020, 5:00 PM
    I’m considering a migration to v2. Can anyone tell me if it’s better to introspect my old prisma server or if I should start a new, normalized MySQL DB from scratch and write a script to move the data?
    n
    j
    a
    • 4
    • 5
  • l

    Larry Hengl

    06/09/2020, 5:27 PM
    Haven't seen others with this prob, so perhaps it's me and could use some ideas to help troubleshoot. I have an Express route that can successfully query postgres with the prisma client (findOne & findMany work fine with my model, I get data). But switching the same route to use raw sql on the same table gives error: TypeError: prisma.raw is not a function
    Copy code
    const { PrismaClient } = require('@prisma/client')
    const prisma = new PrismaClient()
    const result = await prisma.raw`SELECT * FROM Users;`
    (v2beta8, v2beta9 and v2.0 today). I removed and reinstalled all libs and hit the same snag. I tried adding sql and raw to the require, but those are for sql templating and had no effect. Any ideas? Thx!
    a
    j
    • 3
    • 4
  • r

    Robert Hall

    06/09/2020, 9:26 PM
    Quick Q about migrations (still experimental, I know) and Postgres support in v2. Currently in Postgres, you can’t add columns in specific positions (i.e., not at the end of the table) without actually creating a new table based on the old but with the new column in position, copying over data, dropping the old table, and then renaming the new. Is this in the purview of the migrations team? A bit obscure example, I know, but just wondering how deep y’all are thinking about migrations.
    r
    j
    • 3
    • 24
  • j

    Juan Pablo Yamamoto

    06/09/2020, 9:28 PM
    Hello. I wanted to see if someone could help me with a question. If I use prisma client across different files, should I create a new instance in each file? Or should I use a single client?
    r
    • 2
    • 1
  • p

    Philipp Rajah Moura Srivastava

    06/09/2020, 11:10 PM
    Hey, so I am trying to implement an email verification system. I’ve managed to send an email from my graphql-yoga node js server, now I need a link for the user to click on. I’d like the server to have a script that’s executed when the link is clicked. Can someone direct me in the right direction?
    r
    e
    r
    • 4
    • 4
  • s

    Slackbot

    06/10/2020, 10:42 AM
    This message was deleted.
    r
    k
    • 3
    • 3
  • t

    Tiago Correia

    06/10/2020, 3:11 PM
    Hey im having some "problems" using nexus if someone can give a look, I have a schema that looks like this
    Copy code
    import { makeSchema } from '@nexus/schema';
    import * as types from './graphql';
    import path from 'path';
    
    export const schema = makeSchema({
      types,
      outputs: {
        schema: path.join(__dirname, 'generated', 'schema.graphql'),
        typegen: path.join(__dirname, 'generated', 'nexus.ts'),
      },
      typegenAutoConfig: {
        contextType: 'Context.Context',
        sources: [
          {
            source: require.resolve('./context'),
            alias: 'Context',
          },
        ],
      },
    });
    and when I try to generate it by running
    Copy code
    ts-node --transpile-only src/schema
    I have two problems, one of them is because my resolvers call files that either have a db or redis connection and since they are not using lazy connections I get errors related to the connection failure and the generation stops, the other one is because im using this package https://www.npmjs.com/package/env-var for env variables which makes it easier to require env variables and ensure their types, so when I try to generate the schema there are files that depend on this env variables so I get errors because of the env variables not being present To keep using nexus and work around this issues I updated my redis and db connection to be lazy which solves that problem and for the env variables im setting them using env-cmd package the command now looks as follow
    Copy code
    env-cmd ts-node --transpile-only src/schema
    when I use env-cmd on the command it runs without errors but sadly no files are generated, any clue why? sorry for the long post
    b
    r
    • 3
    • 5
  • t

    thevinci

    06/10/2020, 3:36 PM
    Anyone here managed to introspect a cross-schema db setup?
  • t

    thevinci

    06/10/2020, 3:42 PM
    We are interested on migrating our current system to prisma as an orm the only thing that holding us back from doing so is because of its limitation on introspection, as far as I know prisma only supports 1 db schema per introspection/connection. I really do hope that there is a workaround for that. 😊
    j
    • 2
    • 2
  • t

    thevinci

    06/10/2020, 3:50 PM
    We have the same issue as this one https://github.com/prisma/prisma/issues/1175
1...380381382...637Latest