Manthan Mallikarjun
06/12/2021, 2:52 AMprisma.posts
is in reality an object with a create function, update function, etcManthan Mallikarjun
06/12/2021, 2:52 AMManthan Mallikarjun
06/12/2021, 2:53 AMehiz_briel
06/12/2021, 4:57 AMLars Ivar Igesund
06/12/2021, 7:06 AMjasci
06/12/2021, 12:38 PMMatias Martinez
06/12/2021, 3:16 PMAlbert Gao
06/12/2021, 11:43 PMJson
• If I have a field like data Json
, in the runtime, the data will be something like: [{},{}]
, should I type this field as Json[]
then? json can be an array, but what prisma is expecting here? currently, Json
works perfectly fine though
• I constantly getting this error: Index signature is missing in type BlahBlah
when saving against a Json
type field, so basically, I need to extends my type with an object type with index, is this recommended
?Justin Sunseri
06/13/2021, 2:34 AMAlbert Gao
06/13/2021, 9:55 AMPrisma.validator()
what am I missing here, the types are generatedJay Cammarano
06/13/2021, 3:45 PMReleases
and Artists
that have a m-n relationship. I would just put and Artist[]
column on releases and Releases[]
on artists but I want to have the artist's role associated with the Release
. So I made a table ArtistsOnReleases
. It has columns:
model ArtistsOnReleases {
artist Artist @relation(fields: [artistId], references: [id])
artistId Int
release Release @relation(fields: [releaseId], references: [id])
releaseId Int
role Role @default(MAIN)
createdAt DateTime @default(now())
@@id([artistId, releaseId])
}
I want to know how to seed it basically. RN I .create() my two artists and then for each artist I say:
const artistOneJoin = prisma.artistsOnReleases.create({
data: {
artistId: 1,
releaseId: 1,
role: "REMIXER"
}
})
but when I query for artistsOnReleases by artistID equals 1 I don't get anything returned.
I figure this will apply to my mutations for releases as well so I want to get the seeding figured out.manuel
06/13/2021, 6:30 PMAndré Nogueira
06/13/2021, 6:54 PMmanuel
06/13/2021, 7:39 PMnpx prisma db push
my shema changes make it into the db. But if I want to run then npx prisma migrate dev --name whatevername
I get the following error...Omar Ghanim
06/13/2021, 9:42 PMprisma migrate deploy
command doesn't actually migrate the data in the production unless we run the prisma migrate dev
first and generated the local migrations folder; Is this behavior normal? If not, what some other ways we can migrate the data at deployment without migrating in development
the second problem , when we run command npx prisma migrate dev
it gives the following errors (The database server at `<url>`:`5432` was reached but timed out. ) however we increase connection limit and pool , but when we run command npx prisma db push
, schema changed and applied without any problem .Eric Martinez
06/14/2021, 12:13 AMSELECT SUM(IF(COALESCE(nro_factura, -1) != -1, porc_hes, 0)) as sumaPctFacturado FROM ...
I currently have the following with TypeORM and it works fine
select([
'SUM(porc_hes) as sumaPctPagado',
'SUM(IF(COALESCE(nro_factura, -1) != -1, porc_hes, 0)) as sumaPctFacturado'
])
Kenneth Gitere
06/14/2021, 4:32 AMuser
06/14/2021, 7:01 AMuser
06/14/2021, 7:01 AMuser
06/14/2021, 7:02 AMjasci
06/14/2021, 7:08 AMError querying the database: db error: FATAL: sorry, too many clients already
Jijin P
06/14/2021, 7:37 AMawait prisma.campaigns.findMany({
select:{
url:true
},
where: {
status:{
eq: 1
},
AND: {
{
// some conditions
},
{
// [BUG] relation based condition.
OR: [
{
offer_devices: undefined
},
{
// condition based on offer devices.
}
]
},
}
}
})
In this, if the offer_devices relation is null, then the condition is not working. I have tried to comment on the relation condition and it works.
Looks like this condition has the issue.
{
offer_devices: undefined
}
Taylor
06/14/2021, 8:18 AMHarun
06/14/2021, 9:21 AMHarun
06/14/2021, 9:22 AMJohn
06/14/2021, 10:23 AMMykyta Machekhin
06/14/2021, 10:44 AMSebastian
06/14/2021, 1:27 PMimport { prismaMock } from './../singleton';
import { XyzLayerModel } from './../src/api/crud/xyz-layer/xyz-layer.model';
test('Create new xyz-layer', async () => {
const model = new XyzLayerModel()
const newXyz = {
id: 1,
name: 'string',
description: 'string'
}
prismaMock.xyzLayer.create.mockResolvedValue(newXyz);
await expect(model.create(newXyz)).resolves.toEqual({
id: 1,
name: 'string',
description: 'string'
});
});
The following line is highlighted as an error by VSCode:
prismaMock.xyzLayer.create.mockResolvedValue(newXyz);
The error message says:
Type of property 'AND' circularly references itself in mapped type '{ [K in keyof { AND?: Enumerable<XyzLayerScalarWhereWithAggregatesInput>; OR?: Enumerable<XyzLayerScalarWhereWithAggregatesInput>; ... 11 more ...; updatedAt?: string | ... 1 more ... | DateTimeWithAggregatesFilter; }]: Or<...> extends 1 ? { ...; }[K] extends infer TK ? GetHavingFields<...> : never : {} extends Fiel...'.ts(2615)
The same applies to property 'NOT' and 'OR'.
Does someone know a solution for this problem?
Thank you in advance.AlexSPx
06/14/2021, 4:17 PMmodel User {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
email String @unique
username String @unique @db.VarChar(255)
name String
password String
teams Team[]
@@map("user")
}
model Team {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
name String @unique
displayName String
description String @db.VarChar(500)
membersId String[] @db.Uuid
adminsID String[]
members User[] @relation(fields: [membersId], references: [id])
@@map("team")
}
I've tried a few other things to do it, but every time I get this error Key columns "membersId" and "id" are of incompatible types: uuid[] and uuid.
Any help would be appreciated.Michael
06/14/2021, 5:45 PM$> npx prisma generate
Everything runs fine, but all the prior references in my code to any Models I had before are broken/missing.
When I look in node_modules/.pnpm/@prisma/client@2.24.1_prisma@2.24.1/node_modules/@prisma/client/index.d.ts
it's empty except for this one line:
export * from '.prisma/client'
To upgrade the dependency I ran:
$> pnpm up prisma
$> pnpm up @prisma/client