Mohammad Orabi 🇱🇧
Mohammad Orabi 🇱🇧
Explore posts from servers
PPrisma
Created by Mohammad Orabi 🇱🇧 on 11/22/2024 in #help-and-questions
TypedSql generating wrong types from the query
Thank you very much appreciate it yes I think its an important issue , as I was forced to cast my type when querying it for typescript to shutup so that defeats the whole purpose of typedSQL haha
5 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 11/22/2024 in #help-and-questions
TypedSql generating wrong types from the query
here is my related schemas
model Chest {
id String @id @default(cuid()) @map("id")
name String @map("name")
imageUrl String? @map("image_url")
description String? @map("description")
rarity Rarity @map("rarity")
amount Int? @map("amount")
gameId String @map("game_id")
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
currencies ChestCurrency[]
cosmetics ChestCosmetic[]
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")

@@unique([gameId, rarity])
@@index([gameId])
@@map("chests")
}

model ChestKeys {
id String @id @default(cuid()) @map("id")
basic Int @default(0) @map("basic")
premium Int @default(0) @map("premium")
userId String @map("user_id")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
gameId String @map("game_id")
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")

@@unique([userId, gameId])
@@index([userId])
@@index([gameId])
@@map("chest_keys")
}
model Chest {
id String @id @default(cuid()) @map("id")
name String @map("name")
imageUrl String? @map("image_url")
description String? @map("description")
rarity Rarity @map("rarity")
amount Int? @map("amount")
gameId String @map("game_id")
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
currencies ChestCurrency[]
cosmetics ChestCosmetic[]
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")

@@unique([gameId, rarity])
@@index([gameId])
@@map("chests")
}

model ChestKeys {
id String @id @default(cuid()) @map("id")
basic Int @default(0) @map("basic")
premium Int @default(0) @map("premium")
userId String @map("user_id")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
gameId String @map("game_id")
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")

@@unique([userId, gameId])
@@index([userId])
@@index([gameId])
@@map("chest_keys")
}
5 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 11/22/2024 in #help-and-questions
Bug in TypedSQL in version 5.22
will do a new one
9 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 11/22/2024 in #help-and-questions
Bug in TypedSQL in version 5.22
and if you responded , I have another issue that I was not able to fix which is different than this but also TypedSql related , may I share it , or do a new thread?
9 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 11/22/2024 in #help-and-questions
Bug in TypedSQL in version 5.22
yes but I fixed it and it worked correctly with explicitly stating if primary or replica
9 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 11/22/2024 in #help-and-questions
Bug in TypedSQL in version 5.22
maybe worth adding as a warning in the documentation
9 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 11/22/2024 in #help-and-questions
Bug in TypedSQL in version 5.22
okay I fixed it like this
const result = await db.$replica().$queryRawTyped(test());
const result = await db.$replica().$queryRawTyped(test());
9 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 11/22/2024 in #help-and-questions
Bug in TypedSQL in version 5.22
I think I found the root cause if I remove extending replicas it works
const prisma = new PrismaClient().$extends(
readReplicas({
url: databaseUrlReplicas,
}),
);
const prisma = new PrismaClient().$extends(
readReplicas({
url: databaseUrlReplicas,
}),
);
9 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 10/29/2024 in #help-and-questions
Live events with prisma pulse for games
Yes I am on AWS with kubernates with postgres 16 okay is their a way I can test it and see if it fits the needs before paying or so?
4 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
appreciate your time and help mate thank you very much
20 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
yes all sharing same db user max_client_conn is currently 2000 so if all instances all using the same pool , then we can go with default pool size of 2000 max client connection / 25 max num of instances =80 or we can set it as 400 to be equal to max db connections per database? since all same user and prisma start with 1 and increase ?
20 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
Hello @Jon Harrell sorry for the mention , we just did some config and tests and we think we are so close to a solution we just need 1 extra prisma bit and this is our last question here since its the only prisma related thing sorry and thanks in advance lets say *25 containers each container has a prisma client *pg bouncer has 100 default-pool-size per database , and max-db-connections per database is 400 * what should be the number of connection_limit in the prisma string is it * 100 default pool size /25 num of containers = 4 * or same as default pool so also 100 regardless of containers * or unrelated to default-pool-size , its based on 400 max db -connections /25= 16 * or some other formula
20 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
Okay thank you very much for your time and help
20 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
* latest 5.14 * 0.3.0 * most of the time it starts with the primary then replicas start to also fail "other instances of Prisma Client somewhere" I am only exporting 1 code level but yes in cloud run as serverless , each instance has its own client
20 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
we noticed the master is making writes and reads the replicas are only doing reads
20 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
connected to 1 pg bouncer
20 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
so 3 pg bouncer urls
20 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
yes a list of connection strings , pg bouncers also not directs
20 replies
PPrisma
Created by Mohammad Orabi 🇱🇧 on 5/16/2024 in #help-and-questions
Setting Connection limit in gcp cloud run and cloud sql
* yes as shown in gcp insights we are max of 10 * via prisma extension
const prisma = new PrismaClient().$extends(
readReplicas({
url: DATABASE_URL_REPLICAS
})
);
const prisma = new PrismaClient().$extends(
readReplicas({
url: DATABASE_URL_REPLICAS
})
);
* no issues shown on pg bouncer , on sql error it is connection to client lost and in prisma cant reach database we are suspecting that mainly our issue is here
20 replies