Jaye
08/19/2021, 9:02 AMWorkflow
that looks like this:
model Workflow {
id:
id String @id @default(cuid())
// ...
previousReview Workflow? @relation("WorkflowToWorkflow", fields: [workflowId], references: [id])
nextReview Workflow[] @relation("WorkflowToWorkflow")
workflowId String?
}
they can form links in a chain, each one pointing at the next one using the workflowId
column.
when i make a query like this:
const workflow = await prisma.workflow.findUnique({
where: {
id
},
includes: {
previousReview: true,
nextReview: true,
}
})
i can get the previous review fine, but the next review always seems to come out as null, even when it does exist
what am i doing wrong?Mateusz Żmijewski
08/19/2021, 9:53 AMMcd Z
08/19/2021, 9:58 AMuser
08/19/2021, 12:31 PMHalvor
08/19/2021, 1:17 PMNaotho Machida
08/19/2021, 1:44 PMCory Da Silva
08/19/2021, 3:01 PMError: P3006
Migration `20210624184346_added_slug_name` failed to apply cleanly to the shadow database.
Error code: P3018
Error:
A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: <https://pris.ly/d/migrate-resolve>
Migration name: 20210624184346_added_slug_name
Database error code: 1146
Database error:
Table 'prisma_migrate_shadow_db_8ffd3d5c-5d54-4052-91f9-c30857576558.applicationconfig' doesn't exist
Please check the query number 1 from the migration file.
dhatGuy
08/19/2021, 3:44 PMprisma generate
returns error.
Error: Command failed with exit code 3221225781Tyler Clendenin
08/19/2021, 8:11 PMKent C. Dodds
08/19/2021, 8:17 PMmodel PostRead {
id String @id @default(uuid())
createdAt DateTime @default(now())
user User? @relation(fields: [userId], references: [id])
userId String?
clientId String?
postSlug String
}
I want to be able to get a count of distinct rows by userId and clientId (if the user isn't logged in, then I have a randomly generated ID for their client).
I've tried this:
prisma.postRead.groupBy({
_count: true,
by: ['userId', 'clientId'],
})
But that returns an array for each group with _count
which I can then add manually, but I'd prefer to do that in the db.
I've also tried count
, but I'm not sure what to put in my query... And I looked at aggregate but I can't figure out what I'd put in there either 🤔inlightmedia
08/19/2021, 8:47 PMBookingToModeratorParticipant (Relation)
- The id column `id` in link table `_BookingToModeratorParticipant` has been removed.
It was a Prisma legacy column that is not in use anymore.
Applying changes... (0/252)
Applying changes... (33/252)
Applying changes... (87/252)
Applying changes... (102/252)
Applying changes... (121/252)
Applying changes... 26.0s
��� The Migration failed and has not been performed. This is very likely not a
��� transient issue.
��� org.postgresql.util.PSQLException: ERROR: column "id" of relation
��� "_NotificationParamsToPurchasedService" does not exist
After migrating from the old datamodel in prisma1@1.30.5 to prisma1@1.34.12 I’m getting this error. I have verified in psql that the ids for all relations are in fact gone. So, the deploy did work the first time (and there were no errors the first time I deployed). So, I’m not sure why prisma now shows this id column removal notice for every relation and then subsequent error stating that it can’t find the id column on one of them. I’m not querying the id column of any relation anywhere explicitly.
This happens on every prisma deploy when my app starts now.
Any ideas?kkangsan
08/19/2021, 9:21 PMkkangsan
08/19/2021, 9:21 PMnpm install --production
in docker?
I want to lighten the docker image. It would be nice if you could give me an example.user
08/20/2021, 7:05 AMlucaslah
08/20/2021, 7:38 AMMap
type in the schema.prisma
file?Tomasz Rojek
08/20/2021, 7:59 AMThis MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.
I add retryWrites=false
but it do not work
Any ideas ???lucaslah
08/20/2021, 8:03 AMretryWrites=false
or dose it just not work?Tomasz Rojek
08/20/2021, 8:09 AMprgrmmr
08/20/2021, 8:56 AMconst createUser = (req, res, next) => {
const { name, email, password } = req.body;
bcrypt.hash(password, saltRounds, async function(err, hash){
if (err) { res.status(400).json(err); }
try {
let result = await prisma.user.create({
data: {
name,
email,
password: hash
}
});
res.status(200).json(result);
} catch (e) {
res.json(e);
}
});
}
Nichita Z
08/20/2021, 10:27 AMNichita Z
08/20/2021, 10:28 AMfcholak
08/20/2021, 11:03 AMuser
08/20/2021, 12:07 PMChase Roossin
08/20/2021, 2:12 PMNathaniel Babalola
08/20/2021, 2:24 PMconnect
to set a foreignKey....like a userId or I can also just set directly?
userId: 64
or
userId: {
connect: {
id: 64
}
}
Naotho Machida
08/20/2021, 4:07 PMRobin
08/20/2021, 5:13 PMmodel Challenge {
id Int @default(autoincrement()) @id
title String
text String
solution String
points Int
solves Solve[]
}
model Solve {
user User @relation(fields: [userId], references: [id])
userId Int
challenge Challenge @relation(fields: [challengeId], references: [id])
challengeId Int
createdAt DateTime @default(now()) @map(name: "created_at")
@@id([userId, challengeId])
}
Robin
08/20/2021, 5:39 PMlet users = await prisma.user.findMany({
select: {
id: true,
name: true,
solves: {
select: {
challenge: true,
createdAt: true,
},
},
},
});
users = users.map((u) => {
const sum = u.solves.reduce(
(previous, current) => previous + current.challenge.points,
0
);
return { ...u, points: sum };
});
inlightmedia
08/20/2021, 8:36 PMPiyanggoon Keedmor
08/20/2021, 9:23 PM