Adimac93
08/06/2022, 11:27 PMAdimac93
08/06/2022, 11:28 PMLogan
08/07/2022, 12:08 AMmodel serververification {
id String @id @default(cuid())
guildId String @db.VarChar(20)
enabled Boolean @db.Bit(1)
unverifiedRoleId String? @db.VarChar(20)
panelMessageId String? @db.VarChar(20)
panelChannelId String? @db.VarChar(20)
logChannelId String? @db.VarChar(20)
verifiedRoleIds String? @db.LongText
@@index([guildId], map: "guildId_fkey")
}
Hey, if my prisma schema looks like this, then my prisma.serververfication.create
shouldn't be asking me to input an id
right? It should create and generate a unique key for the id
field? Because it doesn't seem to be doing that, it tells me its missing a required field.
serververificationCreateInput.id`: A value is required but not set
Slackbot
08/07/2022, 6:06 AMkonsta
08/07/2022, 12:33 PMArgument of type '{ where: { priority: { in: ("low" | "medium" | "high" | "urgent")[] | null | undefined; }; status: { in: ("open" | "in progress" | "done" | "in review" | "canceled")[] | null | undefined; }; }; by: ("projectId" | ... 1 more ... | "priority")[]; _count: true; orderBy: { ...; }; }' is not assignable to parameter of type '{ where: { priority: { in: ("low" | "medium" | "high" | "urgent")[] | null | undefined; }; status: { in: ("open" | "in progress" | "done" | "in review" | "canceled")[] | null | undefined; }; }; by: ("projectId" | ... 1 more ... | "priority")[]; _count: true; orderBy: { ...; }; } & { ...; } & (`Error: Field "${string...'.
Type '{ where: { priority: { in: ("low" | "medium" | "high" | "urgent")[] | null | undefined; }; status: { in: ("open" | "in progress" | "done" | "in review" | "canceled")[] | null | undefined; }; }; by: ("projectId" | ... 1 more ... | "priority")[]; _count: true; orderBy: { ...; }; }' is not assignable to type '{ where: { priority: { in: ("low" | "medium" | "high" | "urgent")[] | null | undefined; }; status: { in: ("open" | "in progress" | "done" | "in review" | "canceled")[] | null | undefined; }; }; by: ("projectId" | ... 1 more ... | "priority")[]; _count: true; orderBy: { ...; }; } & { ...; } & `Error: Field "${number}...'.
Type '{ where: { priority: { in: ("low" | "medium" | "high" | "urgent")[] | null | undefined; }; status: { in: ("open" | "in progress" | "done" | "in review" | "canceled")[] | null | undefined; }; }; by: ("projectId" | ... 1 more ... | "priority")[]; _count: true; orderBy: { ...; }; }' is not assignable to type '`Error: Field "${number}" in "orderBy" needs to be provided in "by"`'.ts(2345)
Okan Yıldırım
08/07/2022, 1:30 PMNathaniel Babalola
08/07/2022, 11:56 PMDave Edelhart
08/08/2022, 4:33 AM{where: {
task_type_id: type.id,
createdAt: {
gt: new Date(earliestInterval),
},
},
orderBy: {
createdAt: 'asc',
},
};
src/tasks/repeat/repeat.service.ts7747 - error TS2345: Argument of type ‘{ where: { task_type_id: any; createdAt: { gt: Date; }; }; orderBy: { createdAt: string; }; }’ is not assignable to parameter of type ‘{ select?: taskSelect; include?: taskInclude; where?: taskWhereInput; orderBy?: Enumerable<taskOrderByWithRelationInput>; cursor?: taskWhereUniqueInput; take?: number; skip?: number; distinct?: Enumerable<...>; }’.
Types of property ‘orderBy’ are incompatible.
Type ‘{ createdAt: string; }’ is not assignable to type ‘Enumerable<taskOrderByWithRelationInput>‘.
Type ‘{ createdAt: string; }’ is not assignable to type ‘taskOrderByWithRelationInput’.
Types of property ‘createdAt’ are incompatible.
Type ‘string’ is not assignable to type ‘SortOrder’.
schema is
model task {
id String @id @default(uuid())
type task_type @relation(fields: [task_type_id], references: [id])
task_type_id String
task_events task_event[]
notes String?
data Json?
createdAt DateTime @default(now())
last_work_done DateTime?
completedAt DateTime?
status String @default("started")
parent_task task? @relation(name: "parent", fields: [parent_task_id], references: [id])
parent_task_id String?
child_tasks task[] @relation(name: "parent")
}
I have also tried putting the orderBy in an arrayDuckyDev
08/08/2022, 7:43 AMQuentin Gilon
08/08/2022, 3:34 PMERROR: There is a relation ambiguity during the migration. Please first name the old relation on your schema. The ambiguity is on a relation between CustomerSubscription and Plan. Please name relations or change the schema in steps.
{
"data": {
"deploy": null
},
"errors": [
{
"locations": [
{
"line": 2,
"column": 9
}
],
"path": [
"deploy"
],
"code": 3018,
"message": "There is a relation ambiguity during the migration. Please first name the old relation on your schema. The ambiguity is on a relation between CustomerSubscription and Plan. Please name relations or change the schema in steps.",
"requestId": "local:cl6diaxtq001t0818wi9ql9jp"
}
],
"status": 200
}
Fernando
08/08/2022, 3:51 PMwhere
OR
condition but I get nothing back, this is what it looks like:
await prisma.transaction.findMany({
where: {
OR: [
{
description: {
contains: paramKeyword ? paramKeyword : undefined
},
value: {
equals:
paramKeyword && !isNaN(parseInt(paramKeyword)) ? parseInt(paramKeyword) : undefined
}
}
]
}
});
Basically I'm trying to implement a really basic search from url params.
The column types are description: string
and value: number
.
If I comment description
or value
and change nothing else I do get results, but when both conditions are present I get an empty array.
Not sure if it matters, but this is on a SQLite db.
What am I missing?
Thanks!Dhaval Kotak
08/08/2022, 7:38 PMFrancis
08/08/2022, 11:36 PMsagar lama
08/09/2022, 5:45 AMAkshay Kadam (A2K)
08/09/2022, 9:41 AMemail
is 3 levels deep?
License
→ Product
→ User
→ email
but i want to query prisma.license.findMany()
& get email
directly.
export const getLicenses = async (): Promise<
Array<License & Pick<User, 'email'>> | null | undefined
> => {
const userSelect = Prisma.validator<Prisma.ProductSelect>()({
user: {
select: {
email: true,
},
},
})
const productSelect = Prisma.validator<Prisma.LicenseSelect>()({
product: {
include: userSelect,
},
})
const licenses = await prisma.license.findMany({
orderBy: {
createdAt: 'desc',
},
include: productSelect,
})
const result = licenses.map((license) => {
const email = license.product?.user.email
if (email) {
return {
...license,
email,
}
}
})
return result
}
i get error on the last line return result
saying:
Type '({ email: string; id: string; name: string; total: number; used: number; productId: string | null; createdAt: Date; product: (Product & { user: { email: string | null; }; }) | null; } | undefined)[]' is not assignable to type '(License & Pick<User, "email">)[]'.
Type '{ email: string; id: string; name: string; total: number; used: number; productId: string | null; createdAt: Date; product: (Product & { user: { email: string | null; }; }) | null; } | undefined' is not assignable to type 'License & Pick<User, "email">'.
Type 'undefined' is not assignable to type 'License & Pick<User, "email">'.
Type 'undefined' is not assignable to type 'License'.ts(2322)
can't find a way to solve it? here's the full question → https://stackoverflow.com/questions/73289404/get-a-nested-email-field-that-is-part-of-another-model-in-prisma & minimal repro → https://github.com/deadcoder0904/prisma-nested-query-emailDuckyDev
08/09/2022, 10:42 AM2022-08-09T10:08:52.736172785Z Validation Error Count: 1
2022-08-09T10:08:52.736175685Z at LibraryEngine.loadEngine (/node_modules/@prisma/client/runtime/index.js:25244:17)
2022-08-09T10:08:52.736178785Z at async LibraryEngine.instantiateLibrary (/node_modules/@prisma/client/runtime/index.js:25185:5)
2022-08-09T10:08:52.736181685Z at async LibraryEngine.getConfig (/node_modules/@prisma/client/runtime/index.js:25371:5)
2022-08-09T10:08:52.736190185Z at async PrismaService._getActiveProvider (/node_modules/@prisma/client/runtime/index.js:29267:30) {
2022-08-09T10:08:52.736194185Z clientVersion: '4.1.1',
2022-08-09T10:08:52.736197085Z errorCode: 'P1012'
2022-08-09T10:08:52.736199985Z }
user
08/09/2022, 12:00 PMmotiondev
08/09/2022, 12:35 PMEnnabah
08/09/2022, 1:14 PM$ docker exec -it main /bin/sh
# npx prisma migrate dev --name init
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "postgres:5432"
Error: P1001
Can't reach database server at `postgres`:`5432`
Please make sure your database server is running at `postgres`:`5432`.
I have made this project as a guide to reproduce the error I’m receiving, the README.md file contains the steps. I’ve also recorded and attached a (terrible 😬) video recording to show in case you don’t wanna run the project
I’m running on MBP M1 Max if that would help, but I hope I’m doing something wrong and it’s not environment related thingChristophe Rudyj
08/09/2022, 5:42 PMrobert grimes
08/09/2022, 8:15 PMrobert grimes
08/09/2022, 8:16 PMinsert into foo (balh) values (whatever)
into db.foo.create(...)
either from sql statements or an existing dbSchalk Neethling
08/09/2022, 8:23 PMrobert grimes
08/09/2022, 8:34 PMrobert grimes
08/09/2022, 8:34 PMDave Edelhart
08/09/2022, 11:29 PMmodel covid_data_pivot {
iso_alpha_3 String
field String
date DateTime @db.Date
increment Int @default(1)
type String
values_int Int[]
values_float Int[]
@@unique([iso_alpha_3, field])
}
want to delete a single case of iso_alpha_3 / field incidence so I can write a new recordJustin F
08/10/2022, 4:19 AMDeepak Guptha S
08/10/2022, 9:45 AMGoLang
Or how to perform transaction for multiple records (insertion, updation or deletion) using executeRaw
Deepak Guptha S
08/10/2022, 9:46 AM