Michael Roberts
08/02/2022, 9:55 AMwarn(prisma) Conflict for env vars DATABASE_URL_PRODUCTION, DATABASE_URL_DEVELOPMENT, DATABASE_URL, PRIMSA_ENGINE_CLIENT_TYPE in ../../.env and .env
Michael Roberts
08/02/2022, 9:55 AMNiv Oppenhaim
08/02/2022, 11:14 AMMichael Anderjaska
08/02/2022, 2:11 PMkami gerami
08/02/2022, 2:48 PMDave Edelhart
08/02/2022, 5:18 PMAdeodatus Abdul
08/02/2022, 5:23 PMAdeodatus Abdul
08/02/2022, 5:34 PMMatheus Assis
08/02/2022, 5:40 PMBaseline
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 🥴Andreas Du Rietz
08/03/2022, 7:06 AMmodel 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?Rohan Rajpal
08/03/2022, 7:42 AMlax
08/03/2022, 10:40 AMCREATE 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 ?user
08/03/2022, 12:40 PMFrederik
08/03/2022, 12:42 PMMordechai Tzarfati
08/03/2022, 1:13 PMProperty 'answers' does not exist on type '(Questions & { answers: Answers[]; }) | never[]'.
Property 'answers' does not exist on type 'never[]'
and i used this type:
type QuestionWithAnswers = Prisma.QuestionsGetPayload<{
include: { answers: true }
}>
my code:
const question = await this.prisma.questions.findUnique({
where: {
id: questionId
},
include: {
answers: true
}
});
any idea what im doing wrong?hendrikniemann
08/03/2022, 1:57 PMyarn prisma generate
in both and that would generate my clients. For this I set the schema
property in the package.json of the scripts:
"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?Zena Alhello
08/03/2022, 4:56 PMprisma[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)Slackbot
08/03/2022, 7:02 PMMichael Jay
08/03/2022, 8:14 PMhost=/XXX/XXXX:XXXX:XXXX
- do all of the characters there haev to be percent-encoded?Dave Edelhart
08/03/2022, 8:17 PMKal E
08/03/2022, 9:51 PMMichael Jay
08/03/2022, 11:31 PMError: 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:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl"]
}
Michael Jay
08/04/2022, 12:10 AMsagar lama
08/04/2022, 4:22 AMSELECT SUM(foo), DATE(created_at) DateOnly FROM users GROUP BY DateOnly;
Is there a way to do this without raw query using prisma?Logan
08/04/2022, 11:15 AMpanelChannelId
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.
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),
})
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")
}
Logan
08/04/2022, 11:21 AMlogChannelId
i set to `"3"`but in the database it is inserted as 4?
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.Bruno Orosco
08/04/2022, 12:59 PMMichael Jay
08/04/2022, 1:52 PM@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:
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.
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"]
Slackbot
08/04/2022, 3:02 PMNikolaj
08/04/2022, 3:29 PM