Dean Valentine
08/17/2021, 2:49 PMuser
08/17/2021, 4:26 PMprisma chobo
08/17/2021, 6:34 PMMichael Auderer
08/17/2021, 7:07 PMUncaught TypeError: Error resolving module specifier ".prisma/client/index-browser". Relative module specifiers must start with "./", "../" or "/".
prgrmmr
08/17/2021, 7:38 PMBilly Ohgren
08/18/2021, 7:04 AMDev__
08/18/2021, 7:34 AMequals
and not
matic
08/18/2021, 8:41 AM2.12.1
to 2.29.1
and have trouble with migrations. I am following the guide with deleting legacy migrations and making a base one as the starting point but the CLI wants to wipe the database.
I am a bit scared of what is going on. Is there a migration guide that I could follow or someone who could help me with it?Nathaniel Babalola
08/18/2021, 9:39 AMmodel Traveller {
travellerId Int @id @default(autoincrement())
title String
firstName String
lastName String
countryCode String
phoneNo String
address String
state String
country String
bookingRef String
travellerType String? @default("adult")
price String
currency String
isUser Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId Int? // relation scalar field (used in the '@relation()` attribute below)
user User? @relation(fields: [userId], references: [id])
flightBooking FlighBooking @relation(fields: [bookingRef], references: [bookingRef])
@@map(name: "traveller")
}
model FlighBooking {
bookingRef String @id
userId Int?
email String
countryCode String
phoneNo String
flightType String
price Int
currency String
status String?
paymentId String?
adultCount Int
childCount Int
infantCount Int
childDOB String
airlinePNR String?
ticketNo String?
vendorPNR String?
vendorType String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User? @relation(fields: [userId], references: [id])
travellers Traveller[]
flightPostBooking FlightPostBooking[]
@@map(name: "flightBooking")
}
Please who knows how I can perform a CROSS JOIN across these two tables with Prisma?
searching for a single record with a traveller's lastName
AND bookingRef
OR airlinePNR
or vendorPNR
.
The two tables are only joined via bookingRef
Salah eddine Ait Balkacem
08/18/2021, 11:11 AMuser
08/18/2021, 11:27 AMkhareta
08/18/2021, 12:14 PMIrakli Safareli
08/18/2021, 1:36 PMupsertMany
?manuel
08/18/2021, 2:59 PMmanuel
08/18/2021, 2:59 PMwhere
only gets called if a certain argument is present.manuel
08/18/2021, 3:00 PMuser
08/18/2021, 3:10 PMuser
08/18/2021, 3:16 PMGelo
08/18/2021, 5:03 PMHaider Shahid
08/18/2021, 5:36 PMDick Fickling
08/18/2021, 7:19 PMprisma.user.findMany({ where: { followers: { _count: { gt: 50 } } } });
i feel like i must be missing something obviousGiorgio Delgado
08/18/2021, 7:31 PMGiorgio Delgado
08/18/2021, 7:31 PMGiorgio Delgado
08/18/2021, 7:32 PMnpx prisma db push
doesn’t work for us whenever we add new models 😢Salah eddine Ait Balkacem
08/18/2021, 8:25 PMAnirudh Nimmagadda
08/18/2021, 11:27 PM// prisma.js
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
name String
profile Profile?
}
model Profile {
id Int @id @default(autoincrement())
name String
userId Int?
user User? @relation(fields: [userId], references: [id])
photoId Int?
photo Photo? @relation(fields: [photoId], references: [id])
}
model Photo {
id Int @id @default(autoincrement())
url String
profile Profile?
}
The following code works when creating a new profile:
const user = await prisma.user.create({ data: { name: "TestUser" } });
const profile = await prisma.profile.create({
data: {
name: "TestProfile",
user: { connect: { id: user.id } },
photo: { create: { url: "<http://example.com/img>" } },
},
});
... but this fails with an error
const user = await prisma.user.create({ data: { name: "TestUser" } });
const profile = await prisma.profile.create({
data: {
name: "TestProfile",
userId: user.id,
photo: { create: { url: "<http://example.com/img>" } },
},
});
The error is:
Unknown arg `userId` in data.userId for type ProfileCreateInput. Did you mean `user`? Available args:
type ProfileCreateInput {
name: String
user?: UserCreateNestedOneWithoutProfileInput
photo?: PhotoCreateNestedOneWithoutProfileInput
}
Would anyone be able to tell me where to look to learn more about what is happening here?kkangsan
08/19/2021, 5:37 AMuser
08/19/2021, 6:53 AMArfath Tade
08/19/2021, 7:32 AMmodel Activities {
id String @id @default(uuid())
type String
minutes String
}
with data as
id | type | minutes
---------------------------
1 | running | 72
2 | walking | 92
3 | cycling | 32
I want to update minutes of id 1 and 2 in one query.
This is just a sample there can be multiple columns in the above model.
Is there a way to achieve this bulk update through one query?user
08/19/2021, 9:00 AM