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

    Warren Day

    06/02/2020, 4:16 PM
    @Mike SOK Try a findMany query instead of findOne for fields where multiple rows could have the same value
    s
    • 2
    • 1
  • m

    Mike SOK

    06/02/2020, 4:20 PM
    Sorry @Warren Day how do you write a findMany in my example?
  • w

    Warren Day

    06/02/2020, 4:23 PM
    What is your current query causing the error @Mike SOK?
    m
    • 2
    • 3
  • m

    Matt

    06/02/2020, 5:23 PM
    Hi all, I'm running into an issue that seems to have come after I updated my @prisma/cli and @prisma/client to the latest version. Here is the code for the query in question:
    Copy code
    const nextAcctNum = async (state, type, ctx) => {
    	const prefix = state + "-" + (type === "Residential" ? "R" : "C") + "-";
    	highAcct = await ctx.prisma.account.findMany({
    		where: {
    			acct_num: {
    				startsWith: prefix,
    			},
    		},
    		orderBy: { acct_num: "desc" },
    		first: 1,
    	});
    	const highAcctNum = highAcct[0].acct_num;
    	let num = Number(highAcctNum.substr(5)) + 1;
    	let newAcctNum = prefix + num;
    	console.log("New Account Number: ", newAcctNum);
    	return newAcctNum;
    };
    
    module.exports = { nextAcctNum };
    This used to work fine and return the highest account number. Now when I run it, I get this error:
    Copy code
    Error:
    Invalid `prisma.account.findMany()` invocation in
    C:\Users\...\src\nextacctnum.js:3:38
    
    {
      where: {
        acct_num: {
          startsWith: 'AZ-R-'
        }
      },
      orderBy: {
        acct_num: 'desc'
      },
      first: 1
      ~~~~~
    }
    
    Unknown arg `first` in first for type Account. Did you mean `cursor`? Available args:
    type findManyAccount {
      where?: AccountWhereInput
      orderBy?: AccountOrderByInput
      cursor?: AccountWhereUniqueInput
      take?: Int
      skip?: Int
    }
    Does anyone have any idea why I'm getting this error now?
    u
    • 2
    • 4
  • m

    Matt

    06/02/2020, 7:51 PM
    I'm trying to retrieve a list of account numbers (strings) and sort them by the last 6 characters (which are integers) descending. Is there a way in Prisma (Prisma 2, specifically) to sort by a substring or do I need to write raw SQL for this particular function?
    r
    • 2
    • 2
  • j

    James Fox

    06/03/2020, 3:11 AM
    When running prisma locally, I dont see errors logged to the terminal via this command
    "dev": "ts-node-dev -r dotenv/config --tree-kill --transpileOnly --no-notify --debug --respawn src/main.ts"
    Is there a way to log more verbosely?
    r
    • 2
    • 1
  • t

    TEMILOLUWA OJO PHILIP

    06/03/2020, 5:45 AM
    Hi everyone, I deployed my graphql api built with graphql yoga to now(Vercel) but i'm getting a prisma error informing me prisma generate did not initalize yet in my functions log, can anyone help me out here please. I thought the prisma generate command was supposed to run as a postintall hook when the packages get installed or built but this isn't the case.
    • 1
    • 1
  • r

    Rahul Bhooteshwar

    06/03/2020, 3:22 PM
    I am getting started with Prisma v1. I mistakenly deleted some of my tables from Postgres DB. Now when I do
    prisma deploy
    It gets errored reporting about missing tables. I have tried to clean my database, docker instance (deleted the container), recomposing docker for prisma bit no luck at all.
    prisma delete
    is also having error! Can someone guide me here? I want a fresh start with Prisma v1 & Docker.
    r
    • 2
    • 6
  • j

    jruiseco

    06/03/2020, 3:29 PM
    Hello Everyone. Is there an equivalent to prisma deploy vor v2?
    r
    • 2
    • 1
  • a

    Agrippa Kellum

    06/03/2020, 6:51 PM
    I want to use one database url for prisma introspect, and a different one for prisma generate -- specifically, im calling prisma introspect from my dev environment and prisma generate from prod after deployment. any tips on how i should do this?
    r
    • 2
    • 3
  • a

    Ashiqur Rahman

    06/04/2020, 6:55 AM
    why I am getting this error when I try to view posts table from prisma studio?
    r
    • 2
    • 1
  • a

    Abhischek

    06/04/2020, 2:04 PM
    Hi I'm having trouble with an embedded object relation in Prisma 1: In my parent object I have a field defined:
    milestones: [Milestone]
    Copy code
    type Milestone @embedded {
      _id: ID!
      name: String!
      description: String
      completed: DateTime
    }
    But when querying that field in the parent via:
    Copy code
    milestones{
          _id
     }
    I get:
    TypeError: prismaClient[parentName](...)[fieldName] is not a function
    Any suggestions what I'm doing wrong?
  • a

    Ankush Gumber

    06/04/2020, 3:19 PM
    I am not able to connect to my Postgres db that is on heroku when I run prisma init
    r
    • 2
    • 2
  • a

    Ankush Gumber

    06/04/2020, 3:20 PM
    It says password authentication failed
  • a

    Ankush Gumber

    06/04/2020, 3:24 PM
    Anyone
  • a

    Ankush Gumber

    06/04/2020, 3:24 PM
    ?
  • a

    Ankush Gumber

    06/04/2020, 3:24 PM
    I am new to prisma
  • r

    roberto.guerra

    06/04/2020, 3:26 PM
    Maybe your password/username is wrong? Or your application is ingesting the wrong credentials?
  • d

    David Shurgold

    06/04/2020, 3:53 PM
    Good morning everyone. Playing around with the 2.0 version and I'd like to have my 'post' object dealt with in a single file that provides the GET, POST, etc with and without the :id parameter. Poking around documentation I can't find a good reference in how to do that. Would anyone happen to have a link or example on how these features https://github.com/prisma/prisma-examples/tree/master/typescript/rest-nextjs/pages/api/post could be put into a single .ts file. Or am I going down a bad path and if bad a bit of explanation would help me as I prefer all operations on an object to be single file.
    • 1
    • 1
  • g

    Gabriel Benson

    06/04/2020, 7:05 PM
    Hi everyone, I'm having some problems with generating code using "prisma generate". I get the following: "Cannot use GraphQLNonNull "UserWhereUniqueInput!" from another module or realm." Anyone have experience with this, and/or willing to help me figure it out?
  • j

    Jody LeCompte

    06/04/2020, 7:08 PM
    I am attempting to setup a prisma project for the first time and I am getting the following error message after running
    prisma init
    . Any help is greatly appreciated as I could not find anything googling
    r
    • 2
    • 1
  • a

    Alejandro Sanchez

    06/04/2020, 8:21 PM
    Someone can help me with this error?
    Error: Cannot return null for non-nullable field Home.name.
    e
    • 2
    • 32
  • m

    Matt

    06/05/2020, 2:10 AM
    What are people using Nexus/Prisma doing for datetime/timestamp fields in their db. For some reason, Nexus doesn't have them as a scalar type. Do you pull them as strings and then use Moment or some other method to deal with them? Do you create your own scalar type? I don't see any examples of datetime fields in the usual documenation.
    r
    • 2
    • 4
  • p

    Philipp Rajah Moura Srivastava

    06/05/2020, 4:08 AM
    Hey all, I’m kind of new to the async/await format, I’m just wondering why none of the prisma examples use try catch statements when using the prisma API. Is that bad practice? or does prisma take care of errors in a way that you don’t need try catch statements?
    r
    r
    • 3
    • 6
  • s

    SEHYEOK

    06/05/2020, 7:37 AM
    Hi everyone. I'm having one problem with writing
    whereInput
    . what i want to do is comparing two field in whereInput. there are showMessageDateA(type DATE), updatedAt(type Date), So I wanna get data that it's updatedAt greater than it's showMessageDateA I don't know if it is possible So.. could you please let me if it is possible.. and how the thing work please look at line 14 thank you
    r
    • 2
    • 2
  • i

    Ian Buss

    06/05/2020, 9:43 AM
    Hi Ya'll new to Prisma. Looking to implement this w/ GraphQL and a PostgresSQL database for a typescript backend. However when I follow along w/ the instructions where it states to
    npx prisma init
    it doesn't generate the prisma schema or any of the files it should? 😞
  • i

    Ian Buss

    06/05/2020, 11:05 AM
    ...
    r
    • 2
    • 1
  • r

    Reuben Sutton

    06/05/2020, 2:16 PM
    Hi - where is the right place to report a security vulnerability?
    d
    • 2
    • 1
  • a

    Alejandro Sanchez

    06/06/2020, 3:01 AM
    I am confused, do we have to use datamodel.prisma or schema.graphql for updating changes in our data model?
    r
    • 2
    • 5
  • s

    Sm03leBr00t

    06/06/2020, 8:39 AM
    Is there a prisma rust client?
1...379380381...637Latest