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

    Michael Roberts

    08/02/2022, 9:55 AM
    Copy code
    warn(prisma) Conflict for env vars DATABASE_URL_PRODUCTION, DATABASE_URL_DEVELOPMENT, DATABASE_URL, PRIMSA_ENGINE_CLIENT_TYPE in ../../.env and .env
  • m

    Michael Roberts

    08/02/2022, 9:55 AM
    I’m utilising a symbolic link, is there anyway to turn off this warning?
    👀 1
    n
    • 2
    • 2
  • n

    Niv Oppenhaim

    08/02/2022, 11:14 AM
    Hey Prisma team, any plans to release a plugin for Intellij/Webstorm IDE?
    ✅ 1
    n
    n
    • 3
    • 5
  • m

    Michael Anderjaska

    08/02/2022, 2:11 PM
    Question: can zapier write to postgres even if i'm using prisma in front of it? I know prisma does some wizardry with the grants
    ✅ 1
    n
    • 2
    • 1
  • k

    kami gerami

    08/02/2022, 2:48 PM
    hey, so I’m trying to query a model called Timereport and in it I have a relation to another User model. I basically want to search for all entries created by user X between some dates (I have a date field in the timereport model). Can’t figure it out. Just getting null on the user field when I run include and or select. maybe somebody has some input that could point me in the right direction.
    ✅ 1
    n
    • 2
    • 11
  • d

    Dave Edelhart

    08/02/2022, 5:18 PM
    I get “drift detected” a LOT in `migrate dev`; if I DON’T want to delete my data what can I do to fix these situations?
    f
    m
    j
    • 4
    • 22
  • a

    Adeodatus Abdul

    08/02/2022, 5:23 PM
    @eric niyonkuru your welcome from rwanda 🙏
  • a

    Adeodatus Abdul

    08/02/2022, 5:34 PM
    @Emerson Day your welcome .
  • m

    Matheus Assis

    08/02/2022, 5:40 PM
    Hey guys i’m trying to run the
    Baseline
    workflow in my database to fix a problem where a migration was changed. • I deleted all my
    schema.prisma
    • I run
    prisma db pull
    • I try to create the
    initial migration
    . But this command ask to delete the database because there are drift issues. Even though I just ran
    prisma db pull
    so how come there are drifts still?
    If I say yes, it does create the migration but the next migration still has drifts! And when it generates the new, drifted migration, it’s empty 🥴
    CleanShot 2022-08-02 at 13.35.41.mp4
    ✅ 1
    n
    • 2
    • 2
  • a

    Andreas Du Rietz

    08/03/2022, 7:06 AM
    It's been a while since doing SQL and first time for prisma so I'm very rusty. I'm looking to store price entries that I imagine using a composite key like this:
    Copy code
    model DailyPriceEntry {
      areaCode      String
      price         Decimal
      startDate     DateTime
      @@id([areaCode, startDate])
    }
    However, I'm not sure how to query a unique row. The docs seem to suggest I can't use findUnique using composite keys (is that the correct term?) Will I run into more issues with composite keys and should I model it in another way?
    ✅ 1
    n
    • 2
    • 2
  • r

    Rohan Rajpal

    08/03/2022, 7:42 AM
    Hey I’m looking to do the following exactly like in the thread below https://prisma.slack.com/archives/CKQTGR6T0/p1616949553483900 Since this was during prisma2, is there a query to finally sort contact by the most recent message now?
    👀 1
    a
    • 2
    • 3
  • l

    lax

    08/03/2022, 10:40 AM
    hey, i am looking to add not null constraint to a column depending on value of another column in postgres , which will be like below:
    Copy code
    CREATE TABLE my_table
    (
    id serial,
    attribute boolean,
    number integer,
    CONSTRAINT if_attribute_then_number_is_not_null 
       CHECK ( (NOT attribute) OR (number IS NOT NULL) ) 
    ) ;
    if i do directly on postgres. But i dont see any documentation mentioning how this can be done in prisma, so i am wondering if this feature is there in prisma yet or its not supported ?
    i
    • 2
    • 3
  • u

    user

    08/03/2022, 12:40 PM
    What's new in Prisma? (Q2/22) Learn about everything in the Prisma ecosystem and community from April to July 2022.
    🔥 1
    🙌 1
  • f

    Frederik

    08/03/2022, 12:42 PM
    Hello everyone 👋 We are starting design work to improve Prisma’s support for Full Text Search (FTS)! If you would like to help, please let us learn about your needs via a short [FTS user research survey](https://prisma103696.typeform.com/fts-survey). Thank you!
    👋 1
  • m

    Mordechai Tzarfati

    08/03/2022, 1:13 PM
    Copy code
    Property 'answers' does not exist on type '(Questions & { answers: Answers[]; }) | never[]'.
      Property 'answers' does not exist on type 'never[]'
    and i used this type:
    Copy code
    type QuestionWithAnswers = Prisma.QuestionsGetPayload<{
        include: { answers: true }
    }>
    my code:
    Copy code
    const question = await this.prisma.questions.findUnique({
                where: {
                    id: questionId
                },
                include: {
                    answers: true
                }
            });
    any idea what im doing wrong?
    ✅ 1
    n
    m
    • 3
    • 4
  • h

    hendrikniemann

    08/03/2022, 1:57 PM
    Hey Prisma Friends, I have two repos that reference the same prisma file. Basically one is my backend and one is a repo with scripts. In the past I would run
    yarn prisma generate
    in both and that would generate my clients. For this I set the
    schema
    property in the package.json of the scripts:
    Copy code
    "prisma": {
        "schema": "../../backend/prisma/schema.prisma"
      },
    I even have it documented like this. In the scripts repo a rather old version of prisma was installed (3.9.x) and today it stopped working, so I installed prisma 4 (as we have in the backend already). Calling
    yarn prisma generate
    from my scripts repo now generates the files in the backend and no longer for the client installed in scripts ⚠️. I am pretty sure this was not the old behaviour 😕 Is there a way how I can change that? How am I supposed to share a Prisma schema across repositories?
    ✅ 1
    n
    • 2
    • 5
  • z

    Zena Alhello

    08/03/2022, 4:56 PM
    hi , I have a problem, I want to use a variable to represent the name of the model, and I have models with the same fields, tried this
    prisma[modelName].findMany()
    , but I get this error:
    This expression is not callable.
    Each member of the union type has signatures, but none of those signatures are compatible with each other
    (edited)
    ✅ 1
    l
    • 2
    • 10
  • s

    Slackbot

    08/03/2022, 7:02 PM
    This message was deleted.
    m
    • 2
    • 1
  • m

    Michael Jay

    08/03/2022, 8:14 PM
    Edit: I can definitely hit the DB with psql, so I'm pretty sure it has to be a string parsing issue with Prisma. For my schema, there's the host section:
    host=/XXX/XXXX:XXXX:XXXX
    - do all of the characters there haev to be percent-encoded?
    👀 1
    a
    • 2
    • 3
  • d

    Dave Edelhart

    08/03/2022, 8:17 PM
    Hammering through a migration I accidentally hit return and ended up iwth an un-named (20220803201558_) migration. While the number is an identifier of sorts, I’d suggest disallowing “un-semantic” migrations and forcing the user to enter a name string
    ✅ 1
    n
    • 2
    • 1
  • k

    Kal E

    08/03/2022, 9:51 PM
    Hi, I'm trying to get https://github.com/snoopForms/snoopHub database that's in a docker container, but when I try to create an account or migrate I get this 'Error: P1001: Can't reach database server at `localhost`:`5432`'
    ✅ 1
    m
    n
    • 3
    • 3
  • m

    Michael Jay

    08/03/2022, 11:31 PM
    I'm trying to build a Docker image with a NestJS + Prisma application. I just switched from Windows to Mac Monterey OS (on M1 Pro) yesterday. I could build the image on my Windows machine, but now I can't build it on my Mac. Here's the error I'm receiving.
    Copy code
    Error: Unknown binaryTarget linux-arm64-openssl-undefined and no custom engine files were provided
    When I searched that on Google, the first hit was specifically about Prisma: https://github.com/prisma/prisma/issues/861 And that one led me to a pretty detailed conversation https://github.com/prisma/prisma/issues/5245 The conversation says near the end, in July 2021:
    "This will be available for eveyrone with 2.27.0".
    I'm on v
    3.15.1
    My base image is
    node:16.15.1-alpine
    . Anyone have any advice or point me toward further discussion? Alternatively, would it be worth trying to update the binary targets in the Prisma config manually? Actually - should I specify the binary target for the eventual target - which will be a Cloud Run instance? My generator client:
    Copy code
    generator client {
      provider      = "prisma-client-js"
      binaryTargets = ["native", "linux-musl"]
    }
    j
    z
    • 3
    • 16
  • m

    Michael Jay

    08/04/2022, 12:10 AM
    Follow up to the previous question above, because Jared Fraser helped me get closer to what's actually going on. Prisma has engine build names for OpenSSL versions 1.0.x and 1.1.x. But my OpenSSL version is 2.8.3. I tried getting rid of native in the binaryTarget. I tried replacing it with 1.1.x. I was getting good builds on my Windows machine with the linux-musl target, so it shouldn't be that.
    👀 1
    n
    • 2
    • 2
  • s

    sagar lama

    08/04/2022, 4:22 AM
    I'd like to get the dataset of number of user's signed on each day. I don't think groupBy works on created_at because the created_at stores timestamp I found a query that looks like this
    Copy code
    SELECT SUM(foo), DATE(created_at) DateOnly FROM users GROUP BY DateOnly;
    Is there a way to do this without raw query using prisma?
    ✅ 1
    n
    • 2
    • 1
  • l

    Logan

    08/04/2022, 11:15 AM
    Hey. I'm using Python Prisma client and I'm getting some data which is not being inserted into my column. For some reason or another my
    panelChannelId
    is
    null
    , when console logging the value which I am trying to insert, it returns a string. So I'm unsure why it is not putting the data into my db.. I also tried hard coding a value for the
    panelChannelId
    key, and it still appears as null.
    Copy code
    await self.client.prisma.serververification.create(data={
                "guildId": str(interaction.guild.id),
                "enabled": True,
                "logChannelId": None,
                "panelMessageId": str(panel_message.id),
                "panelChannelId": str(verification_channel.id),
                "verifiedRoleId": str(verification_role.id),
            })
    Copy code
    model serververification {
      id             Int     @id @default(autoincrement())
      guildId        String  @db.VarChar(20)
      enabled        Boolean @db.Bit(1)
      logChannelId   String? @db.VarChar(20)
      panelMessageId String? @db.VarChar(20)
      panelChannelId String? @db.VarChar(20)
      verifiedRoleId String? @db.VarChar(20)
    
      @@index([guildId], map: "guildId_fkey")
    }
    ✅ 1
    n
    r
    • 3
    • 3
  • l

    Logan

    08/04/2022, 11:21 AM
    It appears that its not inserting into the correct columns... example:
    logChannelId
    i set to `"3"`but in the database it is inserted as 4?
    Copy code
    await self.client.prisma.serververification.create(data={
                "guildId": "1",
                "enabled": True,
                "logChannelId": "3",
                "panelMessageId": "4",
                "panelChannelId": "5",
                "verifiedRoleId": "6",
            })
    This doesn't make much sense at all.
  • b

    Bruno Orosco

    08/04/2022, 12:59 PM
    Hello guys, a question, I've been using the Date() format in some columns, the recording is done correctly, but when I go to the DB this date comes with 1 day less. can anyone Help me how to solve this.
    ✅ 1
    👀 1
    a
    • 2
    • 2
  • m

    Michael Jay

    08/04/2022, 1:52 PM
    I can't quite get Prisma working in a container, and now I think (hope), I'm at a real general problem, so seeing if anyone has advice. I'll include my Dockerfile. I'm getting this error during spinning up my server:
    @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
    I think this is happening because the
    prisma generate
    must be run before
    npm install
    . Of course, npm install is what installs prisma in the first place. I spun up a new Nest project and tried
    npx prisma generate
    before installing Prisma. That doesn't throw an error - it results in:
    Copy code
    Need to install the following packages:
      prisma
    Ok to proceed? (y)
    So I think maybe my container is ignoring that command prompt (naturally), then trying to run npm install before prisma generate is run. Does this sound like I'm on the right track? The next thing I'm going to try is installing prisma directly, THEN running prisma generate && npm install.
    Copy code
    FROM node:16.15.1-alpine AS development
    
    WORKDIR /usr/src/app
    
    COPY package*.json ./
    
    COPY . .
    
    RUN npx prisma generate && npm install
    
    RUN npm run build
    
    FROM node:16.15.1-alpine AS production
    
    ARG NODE_ENV=production
    ENV NODE_ENV=${NODE_ENV}
    
    WORKDIR /usr/src/app
    
    COPY package*.json ./
    
    RUN npx prisma generate && npm install --production
    
    COPY . .
    
    COPY --from=development /usr/src/app/dist ./dist
    
    CMD ["node", "dist/main"]
    l
    • 2
    • 5
  • s

    Slackbot

    08/04/2022, 3:02 PM
    This message was deleted.
    a
    • 2
    • 1
  • n

    Nikolaj

    08/04/2022, 3:29 PM
    Hello guys. Is there a specific channel where I can ask questions about prisma? 😄
    m
    n
    • 3
    • 3
1...603604605...637Latest