The column active
does not exist in the current database.
#21379
-
QuestionI've following prisma schema: model User {
id String @id @default(cuid())
email String @unique
username String @unique
name String?
active Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
password Password?
sessions Session[]
}
model Session {
id String @id @default(cuid())
expirationDate DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
userId String
// non-unique foreign key
@@index([userId])
} Everything is working fine in the app, but in one of my vitest tests I do following: const session = await prisma.session.create({
data: {
expirationDate: getSessionExpirationDate(),
user: {
create: {
username: "john",
name: "John Doe",
email: "john@example.com"
},
},
},
select: {
id: true,
userId: true,
},
}) And the test is failing saying I've migrated every migrations, and as I said before, I've seen the Expected behavior (optional)The expected behavior is that this should work if I'm not missing anything. Information about Prisma Schema, Client Queries and Environment (optional)
prisma : 5.3.1
@prisma/client : 5.3.1 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Prisma Studio shows you the fields from your model, not necessarily what exists in your database. Does it also show data for that column? Can you confirm the column exists via a different database GUI? |
Beta Was this translation helpful? Give feedback.
Thanks for checking it. It was my bad 🤦♂️ tests were using a different db than the app and needed to migrate that db that was used by tests. Thanks very much for helping me and sorry to totally waste your time 😅