rcastell
09/21/2021, 9:29 PMtable1
WHERE id
= 1
AND EXISTS (SELECT * FROM table2
WHERE contacts
.id
= 3)rcastell
09/21/2021, 9:31 PMChris Tsongas
09/21/2021, 11:23 PM@default(autoincrement())
is there a way to set the autoincrement start value?Casey Chow
09/22/2021, 12:50 AMSKhan
09/22/2021, 4:02 AMconst teamMsgs = await db.changeLog.findMany({
where: {
AND: [
{
teamId: teamData?.teamId,
},
{
OR: [
{
NOT: {
teamMessageId: null,
},
},
{
NOT: {
commentId: null,
},
},
],
},
],
},
select: {
...
See Jee
09/22/2021, 5:35 AMawait this.prismaService.post.findFirst({
where: {
postUid,
}
});
I want to duplicate na data result, is there a function out there I can use?Octal pixel
09/22/2021, 7:40 AMawait prisma.posts.findMany({
where: {
company_id: companyId,
},
select: {
_count: {
select: {
post: true,
},
},
post: {
where: {
status: "published",
},
},
},
});
Octal pixel
09/22/2021, 7:41 AMDmitri Pisarev
09/22/2021, 11:19 AMemail String? @privilege("owner")
Or do I have to use comments for that?Slackbot
09/22/2021, 12:11 PMthdxr
09/22/2021, 1:05 PMVladi Stevanovic
Mattias Rådemar
09/22/2021, 2:08 PMError: PrismaClient is unable to be run in the browser.
. I was reading about that I might need to copy over some binaries using copy-webpack-plugin
but I'm not really sure on exactly what needs to be copied. Any pointers?Fran Dios
09/22/2021, 6:18 PM@relationTable
in P1 and I have renamed all of them in DB (PG9) to follow P2 conventions for implicit n-m relations. However, it now throws with these tables something like The column _AddressBook.B does not exist in the current database.
at run time. And same happens when trying db push
command: Added the required column B to the _AddressBook table without a default value
.
Any ideas? The table looks like this:Christian Goebel
09/22/2021, 6:39 PMgroups
in create.groups for type UserUncheckedCreateInput."
which is right, "groups" is not part of "UserUncheckedCreateInput" type, but it is of "UserCreateInput" type.
I searched around on when prisma expects "Unchecked" Input type and when not, but couldn't find any.
Who knows?kfredericks
09/22/2021, 9:29 PMMichael Aubry
09/22/2021, 11:11 PMThe provided value for the column is too long for the column's type. Column: (not available)
inlightmedia
09/23/2021, 1:51 AMkapil verma
09/23/2021, 4:57 AMkapil verma
09/23/2021, 4:57 AM> api@1.0.0 build
> npm run clean && tsc && npm run prisma generate
> api@1.0.0 clean
> rm -rf dist
node_modules/.prisma/client/index.d.ts(4002,43): error TS2344: Type 'S["include"][P]' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'S["include"]["updates"]' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'S["include"]["updates"]' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'S["include"]["updates"]' is not assignable to type 'DiagramUpdateArgs'.
Type 'S["include"]["updates"]' is not assignable to type 'DiagramUpdateArgs'.
Type 'S["include"][P]' is not assignable to type 'DiagramUpdateArgs'.
Type 'S["include"]["updates"]' is not assignable to type 'DiagramUpdateArgs'.
Type 'S["include"]["updates"]' is not assignable to type 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(4013,43): error TS2344: Type 'S["select"][P]' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'S["select"]["updates"]' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'S["select"]["updates"]' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'S["select"]["updates"]' is not assignable to type 'DiagramUpdateArgs'.
Type 'S["select"]["updates"]' is not assignable to type 'DiagramUpdateArgs'.
Type 'S["select"][P]' is not assignable to type 'DiagramUpdateArgs'.
Type 'S["select"]["updates"]' is not assignable to type 'DiagramUpdateArgs'.
Type 'S["select"]["updates"]' is not assignable to type 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(4357,197): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateFindManyArgs' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateFindManyArgs' is not assignable to type 'DiagramUpdateArgs'.
Type 'T' is not assignable to type 'DiagramUpdateArgs'.
Property 'data' is missing in type 'DiagramUpdateFindManyArgs' but required in type 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(4558,15): error TS2300: Duplicate identifier 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(4878,218): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateFindUniqueArgs' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateFindUniqueArgs' is not assignable to type 'DiagramUpdateArgs'.
Type 'T' is not assignable to type 'DiagramUpdateArgs'.
Property 'data' is missing in type 'DiagramUpdateFindUniqueArgs' but required in type 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(4878,344): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
node_modules/.prisma/client/index.d.ts(4895,217): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateFindFirstArgs' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateFindFirstArgs' is not assignable to type 'DiagramUpdateArgs'.
Type 'T' is not assignable to type 'DiagramUpdateArgs'.
Property 'data' is missing in type 'DiagramUpdateFindFirstArgs' but required in type 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(4895,343): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
node_modules/.prisma/client/index.d.ts(4915,104): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateFindManyArgs' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'T' is not assignable to type 'DiagramUpdateArgs'.
Type 'DiagramUpdateFindManyArgs' is not assignable to type 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(4931,119): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateCreateArgs' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateCreateArgs' is not assignable to type 'DiagramUpdateArgs'.
Type 'T' is not assignable to type 'DiagramUpdateArgs'.
Property 'where' is missing in type 'DiagramUpdateCreateArgs' but required in type 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(4963,119): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateDeleteArgs' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateDeleteArgs' is not assignable to type 'DiagramUpdateArgs'.
Type 'T' is not assignable to type 'DiagramUpdateArgs'.
Property 'data' is missing in type 'DiagramUpdateDeleteArgs' but required in type 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(4982,119): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateUpdateArgs' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateUpdateArgs' is not assignable to type 'DiagramUpdateArgs'.
Type 'T' is not assignable to type 'DiagramUpdateArgs'.
Type 'DiagramUpdateUpdateArgs' is not assignable to type 'DiagramUpdateArgs'.
Types of property 'include' are incompatible.
Type 'DiagramUpdateInclude | null | undefined' is not assignable to type 'DiagramInclude | null | undefined'.
Type 'DiagramUpdateInclude' has no properties in common with type 'DiagramInclude'.
node_modules/.prisma/client/index.d.ts(5040,119): error TS2344: Type 'T' does not satisfy the constraint 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateUpsertArgs' is not assignable to type 'boolean | DiagramUpdateArgs | null | undefined'.
Type 'DiagramUpdateUpsertArgs' is not assignable to type 'DiagramUpdateArgs'.
Type 'T' is not assignable to type 'DiagramUpdateArgs'.
Property 'data' is missing in type 'DiagramUpdateUpsertArgs' but required in type 'DiagramUpdateArgs'.
node_modules/.prisma/client/index.d.ts(5491,15): error TS2300: Duplicate identifier 'DiagramUpdateArgs'.
Harsha MV
09/23/2021, 5:46 AMPrismaClientInitializationError:
Invalid `prisma.project.findMany()` invocation:
Error querying the database: db error: FATAL: remaining connection slots are reserved for non-replication superuser connections
at cb (/Users/harshamv/Sites/nftvoltclub/node_modules/@prisma/client/runtime/index.js:36958:17)
at async handler (webpack-internal:///./pages/api/projects/new.js:19:24)
at async Object.apiResolver (/Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/api-utils.js:101:9)
at async DevServer.handleApiRequest (/Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/next-server.js:760:9)
at async Object.fn (/Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/next-server.js:651:37)
at async Router.execute (/Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/router.js:205:32)
at async DevServer.run (/Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/next-server.js:825:29)
at async DevServer.handleRequest (/Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/next-server.js:292:20) {
clientVersion: '3.1.1',
errorCode: undefined
}
PrismaClientInitializationError:
Harsha MV
09/23/2021, 5:46 AMimport { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
export default prisma;
ezeikel
09/23/2021, 7:56 AMprisma generate
and having a file be created with all the possible CRUD operations based on my Models. Then i could just look at that file and find the Prisma created function that I needed and add it to my Query/Mutation.
It doesn't seem to work like this in the latest version? How do I know what functions I can call? Or is it just the generic ones listed here - https://www.prisma.io/docs/reference/api-reference/prisma-client-referencePatiparn Intaraprasert
09/23/2021, 9:32 AMglekner
09/23/2021, 2:54 PMwhere
clause inside a _count
inclusion like this?
include: {
_count: {
select: {
workers: true,
tasks: {
where: {
isCompleted: false,
}
},
},
},
}
Bamada
09/23/2021, 10:12 PMPrisma 3.1.1
with one of my projects.
Inside my code, I use the rawQuery
below and I want to type the result of the query.
const configs = await this.prismaService.$queryRaw<Config[] >`SELECT id, employee_id, start_date, end_date
FROM configs mc
WHERE employee_id IN (${Prisma.join(employeeIds)})
AND DATE_PART('year', mc.start_date) = CAST(${year} AS INTEGER)
AND CAST(${month} AS INTEGER) >= DATE_PART('month', mc.start_date)
AND CAST(${month} AS INTEGER) <= DATE_PART('month', COALESCE(end_date,'2020-12-01'))`;
// generated type
export type Config = {
id: number
employeeId: string
startDate: Date
endDate: Date | null
}
// Expected result
[Config{id:1, startDate:xxxx, endDate:xx, ..}, ..]
// I got
[{id:1, start_date:xxxx, end_date:xx, ..}, ..]
Do you know what’s wrong with my query?
I looked at the documentation https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access and I didn’t found my mistake
thksLogan
09/24/2021, 12:44 AMconst valid = await client.prisma.invites
.aggregate({
_count: {
inviterId: true,
},
where: {
inviterId: mUser,
valid: true,
serverId: message.guildID,
},
})
.catch((e: unknown) => client.logger.error(String(e)));
const invalid = await client.prisma.invites
.aggregate({
_count: {
inviterId: true,
},
where: {
inviterId: mUser,
valid: false,
serverId: message.guildID,
},
})
.catch((e: unknown) => client.logger.error(String(e)));
const result = await client.prisma.invites
.groupBy({
by: ["inviterId"],
_count: {
inviterId: true,
},
where: {
serverId: message.guildID,
inviterId: mUser,
},
})
Hey, just wondering if theres a good way of speeding these query's up? We are using SQL databaseJared Fraser
09/24/2021, 5:58 AMonly
filter for 1-N
relations?
Currently the options for every
, some
and none
are limiting.
It would be good to query
children: {
only: {
field: "value"
}
}
and it would return children that only match the filterJared Fraser
09/24/2021, 6:00 AMSELECT *
FROM parent p
JOIN children c ON (c.parent_id = p.id)
WHERE c.field = "value"
Martin Nirtl
09/24/2021, 6:14 AM