Fabriece Sumuni
10/27/2021, 8:42 AM_count
be used with .findUnique
?Kristofer Pervin
10/27/2021, 2:04 PMn
10/27/2021, 3:44 PMEzequiel Pereira
10/27/2021, 4:31 PMMichael Aubry
10/27/2021, 5:32 PMColumn: (not available)
I think this is due to a concurrency issue? Are there any guides on setting up serverless with AWS RDS?Danny
10/27/2021, 5:57 PM--create-only
so I can edit it to copy the data to the new column, but I'm getting an error when trying to execute the file during the actual migration itselfBruno Casado
10/27/2021, 6:08 PMselect gene_1_id , wi.genotype_emedgene_1, wi.genotype_emedgene_2, genotype_1, genotype_2 from womancare_info wi
where
(
wi.genotype_emedgene_1 in (select genotype from gene_genotype gg where wi.localization_1 = gg.localization)
and
wi.genotype_emedgene_2 in (select genotype from gene_genotype gg where wi.localization_2 = gg.localization)
)
or
(
wi.genotype_emedgene_1 in (select genotype from gene_genotype gg where wi.localization_1 = gg.localization) and wi.genotype_emedgene_2 = ''
);
where:
wi.genotype_emedgene_1 in (select genotype from gene_genotype gg where wi.localization_1 = gg.localization)
How do i perform this kind of query using prisma? Filtering by using a parent field on subquery?n
10/28/2021, 1:52 AMDavid
10/28/2021, 4:00 AMprisma migrate dev
I get the "migration was modified after it was applied" for my two most recent ones. No changes have been made to either of the migrations and I'd really like to avoid needing to store and reseed all my current data into prisma.
Any ideas why this occurs, what could happen, and how to solve?terion
10/28/2021, 8:34 AMDia TM
10/28/2021, 10:12 AMgenerator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
email String @unique @db.VarChar(255)
firstname String @db.VarChar(255)
lastname String @db.VarChar(255)
created_at DateTime @default(now())
updated_at DateTime?
posts Post[]
@@map("users")
}
model Post {
id Int @id @default(autoincrement())
title String @db.VarChar(255)
content String @db.Text
images Image[]
comments Comment[]
created_at DateTime @default(now())
updated_at DateTime?
user User @relation(fields: [userId], references: [id])
userId Int
@@map("posts")
}
model Image {
id Int @id @default(autoincrement())
puth String @db.VarChar(255)
Post Post @relation(fields: [postId], references: [id])
postId Int
@@map("images")
}
model Comment {
id Int @id @default(autoincrement())
comment String @db.Text
post Post @relation(fields: [postId], references: [id])
postId Int
@@map("comments")
}
import { Injectable } from '@nestjs/common';
import { PrismaService } from '../prisma.service';
import { Post, Prisma } from '@prisma/client';
@Injectable()
export class PostsService {
constructor(private prisma: PrismaService) {}
async findAll(): Promise<Post[]> {
return this.prisma.post.findMany({
include: {
user: {
select: {
firstname: true,
lastname: true,
},
},
images: {
select: {
id: true,
puth: true,
},
},
_count: {
select: {
comments: true
}
},
},
});
}
}
J Giri
10/28/2021, 12:14 PMTyler Clendenin
10/28/2021, 2:16 PM@default("0001-01-01T00:00:00Z")
seems to work, but it also seems to always try and change the default in the database with any new migration ALTER COLUMN "dateAt" SET DEFAULT '0001-01-01 00:00:00 +00:00'
. @default("0001-01-01 00:00:00 +00:00")
gives this error
Error parsing attribute "@default": Expected a datetime value, but failed while parsing ""0001-01-01 00:00:00 +00:00"": input contains invalid characters.
if i keep creating migrations it keeps trying to alter the columns defaultVladi Stevanovic
Tom MacWright
10/28/2021, 6:24 PM.upsert
calls is a bottleneck in my app, so I'm trying to switch to either createMany
with ignoring duplicates, or queryRaw
. I'm hitting the issues that (1) there's no upsertMany
. (2) createMany
doesn't return the duplicated rows and updateMany
doesn't let you specify multiple where
conditions, and (3) queryRaw
doesn't appear to support arrays-of-arrays as arguments. This is a bit of a bummer. I'm trying to just have some raw SQL in this part of my app because the ORM-unoptimized version is not sufficient, but the queryRaw bit doesn't seem to work either for this usecase.Tom MacWright
10/28/2021, 6:34 PMchrisdrackett
10/28/2021, 7:46 PMError: Cannot find module '.prisma/client'
. We haven’t updated prisma or changed anything, so we’re a bit confused and I’m curious if anyone else has seen similarAustin Zentz
10/28/2021, 7:54 PMMichael Aubry
10/28/2021, 8:01 PMmodel Media {
id String @id @default(cuid())
createdat DateTime? @default(now())
updatedat DateTime? @default(now())
date DateTime?
duration Float?
loading Boolean?
mediaurl String?
name String?
thumbnails String?
trimmed Boolean?
type String?
uid String?
thumbnailSprites String?
metadata String?
owner UserMedia[]
}
I am facing this error. Is there a way to increase the column character count? Specifically the id
unique column. I am a bit confused which column is causing this issue.Austin Zentz
10/28/2021, 8:02 PMMichael Aubry
10/28/2021, 8:03 PMMichael Aubry
10/28/2021, 8:04 PMMichael Aubry
10/28/2021, 8:11 PMMichael Aubry
10/28/2021, 8:11 PMAustin Zentz
10/28/2021, 8:13 PMAustin Zentz
10/28/2021, 8:14 PMAustin Zentz
10/28/2021, 8:14 PMAustin Zentz
10/28/2021, 8:14 PMMichael Aubry
10/28/2021, 8:15 PMSunao Suzuki
10/29/2021, 1:28 AMthis.$use(async (params, next) => {
if ( xxxxxxx === yyyyyy ) {
await this.$executeRaw(`SET app.currentTenant='${tenantId}';`);
}
return next(params);
});
So I want to confirm that in this case the connection of both executeRaw and next is same or not? Or is this any good way to do this?