Mert Efe
Mert Efe
Explore posts from servers
PPrisma
Created by Mert Efe on 10/11/2024 in #help-and-questions
Why is this error hapenning on seeding?
No description
2 replies
PPrisma
Created by Mert Efe on 8/1/2024 in #help-and-questions
Everytime i make a small change in DB, i have to reset. I get this warning everytime.
- The migration `20240717073712_` was modified after it was applied.
- The migration `20240722125612_init` was modified after it was applied.
- The migration `20240722131050_init` was modified after it was applied.
- The migration `20240722131821_init` was modified after it was applied.
- The following migration(s) are applied to the database but missing from the local migrations directory: 20240722124933_init, 20240722124933_init
- The migration `20240717073712_` was modified after it was applied.
- The migration `20240722125612_init` was modified after it was applied.
- The migration `20240722131050_init` was modified after it was applied.
- The migration `20240722131821_init` was modified after it was applied.
- The following migration(s) are applied to the database but missing from the local migrations directory: 20240722124933_init, 20240722124933_init
IF I deleted my migrations file completely and run the migration again, when deploying this to production, would it break down anything?
2 replies
PPrisma
Created by Mert Efe on 4/4/2024 in #help-and-questions
Raw query doesn't work
let result: any = await this.prisma.$queryRaw`
select V.name, V.id, SUM(O."amount"::BIGINT)::BIGINT
from "Variety" V
left join "Flower" as F on F."varietyId" = V.id
left join "Orderline" as O on O."flowerId" = F.id

group by V.id, V.name`;
let result: any = await this.prisma.$queryRaw`
select V.name, V.id, SUM(O."amount"::BIGINT)::BIGINT
from "Variety" V
left join "Flower" as F on F."varietyId" = V.id
left join "Orderline" as O on O."flowerId" = F.id

group by V.id, V.name`;
Do not know how to serialize a BigInt
3 replies
PPrisma
Created by Mert Efe on 3/29/2024 in #help-and-questions
Why getting typescript error only selecting few fields?
const admins = await this.prisma.admin.findMany({
where: {
...filters,
},
select: {
id: true,
email: true,
userName: true,
deleted: true,
},
});

return admins;
const admins = await this.prisma.admin.findMany({
where: {
...filters,
},
select: {
id: true,
email: true,
userName: true,
deleted: true,
},
});

return admins;
src/admin/admin.service.ts:56:5 - error TS2322: Type '{ id: number; email: string; userName: string; deleted: boolean; }[]' is not assignable to type '{ id: number; email: string; userName: string; password: string; role: AdminRole; deleted: boolean; createdAt: Date; }[]'.
Type '{ id: number; email: string; userName: string; deleted: boolean; }' is missing the following properties from type '{ id: number; email: string; userName: string; password: string; role: AdminRole; deleted: boolean; createdAt: Date; }': password, role, createdAt

56 return admins;
~~~~~~

[1:25:46 PM] Found 1 error. Watching for file changes.
src/admin/admin.service.ts:56:5 - error TS2322: Type '{ id: number; email: string; userName: string; deleted: boolean; }[]' is not assignable to type '{ id: number; email: string; userName: string; password: string; role: AdminRole; deleted: boolean; createdAt: Date; }[]'.
Type '{ id: number; email: string; userName: string; deleted: boolean; }' is missing the following properties from type '{ id: number; email: string; userName: string; password: string; role: AdminRole; deleted: boolean; createdAt: Date; }': password, role, createdAt

56 return admins;
~~~~~~

[1:25:46 PM] Found 1 error. Watching for file changes.
2 replies