Jan G.
02/08/2022, 4:41 AMSophia
02/08/2022, 5:00 AMError: Cannot find module '_http_common'
.Sophia
02/08/2022, 5:00 AMWahyu
02/08/2022, 8:18 AMOleg Rudak
02/08/2022, 10:16 AMArtem
02/08/2022, 3:36 PM@prisma/client
, which attempts to read the config2.datamodelPath
at LibraryEngine
. Sharing more details below 👇Cody Moore
02/08/2022, 3:47 PMYaakov
02/08/2022, 8:20 PMmodel Person {
id Int @id @default(autoincrement())
doctor Doctor?
lawyer Lawyer?
}
model Doctor {
id Int @id
person Person @relation(fields: [id], references: [id])
}
model Lawyer {
id Int @id
person Person @relation(fields: [id], references: [id])
}
Peter Kellner
02/08/2022, 8:38 PMconst data = await context.prisma.News.findMany({
include: { CodeCampYear: true }
});
model News {
Id Int @id(map: "PK__News__3214EC07CA2FD4E0") @default(autoincrement())
CodeCampYearId Int
Visible Boolean?
Title String? @db.VarChar(256)
Description String @db.VarChar(1024)
Authors String @db.VarChar(256)
CreatedDate DateTime @db.DateTime
UpdatedDate DateTime? @db.DateTime
ContentData String? @db.Text
UrlExternal String? @db.VarChar(512)
PostDate DateTime? @db.DateTime
YouTubeUrl String? @db.VarChar(256)
AuthorImageUrl String? @db.VarChar(256)
AuthorAttendeesId Int?
AuthorEmail String? @db.VarChar(128)
YouTubeCode String? @db.VarChar(128)
PictureUrl String? @db.VarChar(128)
CodeCampYear CodeCampYear @relation(fields: [CodeCampYearId], references: [Id], onUpdate: NoAction, map: "News_fk")
@@unique([CodeCampYearId, Title], map: "News_uq")
}
model CodeCampYear {
Id Int @id(map: "PK__CodeCamp__3214EC07BF12A5BA")
Name String @db.VarChar(128)
...
VolunteerJob VolunteerJob[]
}
and the generated sql logged
SELECT
[ dbo ].[ CodeCampYear ].[ Id ],
[ dbo ].[ CodeCampYear ].[ Name ],
[ dbo ].[ CodeCampYear ].[ CampStartDate ],
[ dbo ].[ CodeCampYear ].[ CampEndDate ],
[ dbo ].[ CodeCampYear ].[ CodeCampDateString ],
[ dbo ].[ CodeCampYear ].[ CodeCampSaturdayString ],
[ dbo ].[ CodeCampYear ].[ CodeCampSundayString ],
[ dbo ].[ CodeCampYear ].[ HostName ],
[ dbo ].[ CodeCampYear ].[ BaseUrl ],
[ dbo ].[ CodeCampYear ].[ UrlPostToken ],
[ dbo ].[ CodeCampYear ].[ TagLine ],
[ dbo ].[ CodeCampYear ].[ CodeCampYearTypeId ],
[ dbo ].[ CodeCampYear ].[ EmailFooterImage ],
[ dbo ].[ CodeCampYear ].[ EmailHeaderImage ],
[ dbo ].[ CodeCampYear ].[ EmailBgImage ],
[ dbo ].[ CodeCampYear ].[ EmailAdLinkUrl ],
[ dbo ].[ CodeCampYear ].[ EmailAdLinkImage ],
[ dbo ].[ CodeCampYear ].[ EmailAdLinkImageMarginTop ],
[ dbo ].[ CodeCampYear ].[ EmailAdLinkImageWidth ],
[ dbo ].[ CodeCampYear ].[ MeetupDetailsRequiredWord1 ],
[ dbo ].[ CodeCampYear ].[ MeetupDetailsRequiredWord2 ],
[ dbo ].[ CodeCampYear ].[ MeetupReferralUrl ],
[ dbo ].[ CodeCampYear ].[ MeetupGroupReferralImage ],
[ dbo ].[ CodeCampYear ].[ MeetupReferralText ],
[ dbo ].[ CodeCampYear ].[ SiteLocked ],
[ dbo ].[ CodeCampYear ].[ NgUrlDefault ],
[ dbo ].[ CodeCampYear ].[ LiveStreamFeedOverride ],
[ dbo ].[ CodeCampYear ].[ ShowLiveFeedStart ],
[ dbo ].[ CodeCampYear ].[ ShowLiveFeedEnd ],
[ dbo ].[ CodeCampYear ].[ LiveFeedEmbedCode ],
[ dbo ].[ CodeCampYear ].[ LiveFeedEmbedCodeEmpty ],
[ dbo ].[ CodeCampYear ].[ LiveFeedTitle ],
[ dbo ].[ CodeCampYear ].[ LiveFeedTrackId ],
[ dbo ].[ CodeCampYear ].[ LiveFeedSponsorNameDefault ],
[ dbo ].[ CodeCampYear ].[ LiveFeedSponsorUrlDefault ],
[ dbo ].[ CodeCampYear ].[ LiveFeedCurrentSessionId ],
[ dbo ].[ CodeCampYear ].[ Address ],
[ dbo ].[ CodeCampYear ].[ City ],
[ dbo ].[ CodeCampYear ].[ State ],
[ dbo ].[ CodeCampYear ].[ Zipcode ],
[ dbo ].[ CodeCampYear ].[ LocationName ],
[ dbo ].[ CodeCampYear ].[ HackathonDateString ],
[ dbo ].[ CodeCampYear ].[ HackathonLocation ],
[ dbo ].[ CodeCampYear ].[ HackathonLocationUrl ]
FROM
[ dbo ].[ CodeCampYear ]
WHERE
1 = 1 []
Query CodeCampYear.findMany took 792ms
SELECT
1 []
SELECT
[ dbo ].[ News ].[ Id ],
[ dbo ].[ News ].[ CodeCampYearId ],
[ dbo ].[ News ].[ Visible ],
[ dbo ].[ News ].[ Title ],
[ dbo ].[ News ].[ Description ],
[ dbo ].[ News ].[ Authors ],
[ dbo ].[ News ].[ CreatedDate ],
[ dbo ].[ News ].[ UpdatedDate ],
[ dbo ].[ News ].[ ContentData ],
[ dbo ].[ News ].[ UrlExternal ],
[ dbo ].[ News ].[ PostDate ],
[ dbo ].[ News ].[ YouTubeUrl ],
[ dbo ].[ News ].[ AuthorImageUrl ],
[ dbo ].[ News ].[ AuthorAttendeesId ],
[ dbo ].[ News ].[ AuthorEmail ],
[ dbo ].[ News ].[ YouTubeCode ],
[ dbo ].[ News ].[ PictureUrl ]
FROM
[ dbo ].[ News ]
WHERE
1 = 1 []
Query News.findMany took 556msElie Steinbock
02/09/2022, 12:04 AMJonathan Marbutt
02/09/2022, 1:20 AMJonathan Marbutt
02/09/2022, 1:21 AMaccountCreateInput
but it would be awesome if there was some way to just see FirstName is missing
Michael Aubry
02/09/2022, 3:31 AMreturn prisma.media.create({
data: {
duration,
loading,
mediaurl,
name,
type,
user: {
connect: {
id: ownerId,
},
},
},
});
Gelo
02/09/2022, 6:14 AMBrothak
02/09/2022, 7:55 AMBrothak
02/09/2022, 7:56 AMBrothak
02/09/2022, 8:08 AMNima
02/09/2022, 9:38 AMBrothak
02/09/2022, 1:23 PMreturn this.prisma.users.findMany({
select: {
name: true,
type_id: true,
_count: {
select: {
posts: true
}
}
}
});
}
}
Kay Khan
02/09/2022, 1:59 PMKay Khan
02/09/2022, 2:12 PMimport { PrismaService } from "@services/mysql.service";
import { mocked } from "ts-jest/utils";
import faker from "@faker-js/faker";
import { GetBrands } from "./brand";
jest.mock("@services/mysql.service");
/**
* @group unit
*/
describe("Brand", () => {
afterAll(async () => {});
it("should get a list of brands", async () => {
const mockedData = [
{
id: faker.datatype.uuid(),
name: faker.datatype.string(),
image: {
source: "some_source",
dtype: "some_dtype",
},
},
];
const mockedPrismaService = mocked(PrismaService, true);
//@ts-ignore
mockedPrismaService.brand.findMany.mockResolvedValueOnce(mockedData);
const [response, error] = await GetBrands();
console.log(response, error);
});
});
However im getting the error, apparently mockedPrismaService
is undefined
TypeError: Cannot read properties of undefined (reading 'brand')
Kay Khan
02/09/2022, 3:13 PMAlex Vilchis
02/09/2022, 3:19 PMAnirudh Nimmagadda
02/09/2022, 3:23 PMThe migration ... was modified after it was applied. We need to reset the database
error in dev? I'm running prisma migrate dev --create-only
.
I've already done a manual check to verify that the db and migrations are in-sync. I want to avoid re-seeding my dev database - there's a lot of test data and re-seeding it in a reasonable amount of time would involve a lot of index hackery.Cristian Salamea
02/09/2022, 3:34 PMgetLastName()
or getfirstName()
so when I const user = await prisma.User.FindOne({})
then can do: user.getLastName()
its possible that ?user
02/09/2022, 6:00 PMCody Moore
02/09/2022, 6:50 PM@map
in the schema file (image attached)
Once I make a change I run yarn prisma generate
and the .prisma/client
folder is updated in node_modules
Looking at the index.js file, nothing seems to be changed and I am still getting the column name (image attached). Seems like it is ignoring @map
.
Am I doing something wrong. This seems so simple but yet I am banging my head against the wall. Any help would be greatly appreciated. Running the latest version of prisma
and @prisma/client
.mel
02/09/2022, 7:34 PMmodel User {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
request Request?
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @db.Timestamptz(6)
}
model Request {
id Int @id @default(autoincrement())
user User @relation(fields: [id], references: [id])
// I also tried making the relation field userId
createdAt DateTime @default(now()) @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @db.Timestamptz(6)
}
When I try to migrate this, I get an error that says:
failed to apply cleanly to the shadow database. Error: db error: ERROR: foreign key constraint “Request_userId_fkey” cannot be implemented DETAIL: Key columns “userId” and “id” are of incompatible types: text and uuid.The prisma documents dont show an example using uuid. The example they do give has a second parameter in the Profile model which has a userId as an Int. I tried adding this to my Request model (as an int, as a string and as a uuid). None of these worked.
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
role Role @default(USER)
posts Post[]
profile Profile?
}
model Profile {
id Int @id @default(autoincrement())
bio String
user User @relation(fields: [userId], references: [id])
userId Int
}
How can I reference a userId when it is generated using uuid? thank youOkan Yıldırım
02/09/2022, 7:48 PMOkan Yıldırım
02/09/2022, 7:48 PM