Clément Guibout
09/08/2022, 10:42 PMmodel Event {
evt_id String @id @default(uuid())
evt_title String @db.VarChar(100)
evt_content String @db.VarChar(1024) @default("Cet événement n'a pas encore de description.")
evt_picture String? @db.VarChar(1024) @default("/img/events/default.png") // Local path
evt_likeCount Int @default(0)
evt_beginDate DateTime
evt_endDate DateTime
evt_participants User[]
evt_created_at DateTime @db.Timestamp() @default(now())
evt_updated_at DateTime @updatedAt
evt_isVerified Boolean
}
model User {
usr_id String @id @default(cuid())
usr_token String @db.VarChar(1024) @unique
usr_name String? @db.VarChar(100)
usr_nickname String? @db.VarChar(32) @unique
usr_email String @db.VarChar(100) @unique
usr_profilePicture String? @db.VarChar(1024) @default("/img/users/default.png") // Local path
usr_events Event[]
usr_createdAt DateTime @db.Timestamp @default(now())
}
I created my database etc using npx prisma generate, and I have no migration in this project
But when accessing the studio, I get the error: ``The table public._EventToUser
does not exist in the current database.``
Oh boy I don't understand from where this could even come from...
Could someone indicate me the path? I feel like this is an internal thing for prisma, but cannot find anything......Raphael Etim
09/09/2022, 4:48 AMnpx prisma migrate dev --name init
or you use the npx prisma db push
command in order to have Prisma synchronize your Prisma Schema with your database schema. After either of these previous commands finishes, you can then run npx prisma generate
. You can follow this guide to help you understand the workflow better.Clément Guibout
09/09/2022, 9:45 AMClément Guibout
09/09/2022, 9:48 AMMessage: Error in Prisma Client request:
Invalid `prisma.event.findMany()` invocation:
The table `public._EventToUser` does not exist in the current database.
Clément Guibout
09/12/2022, 1:42 PMAustin
09/16/2022, 6:12 PMClément Guibout
09/18/2022, 9:30 PMAustin
09/20/2022, 7:45 PMnpx prisma migrate --create-only
, the generated migration file had a statement to create the _EventToUser
table and after running npx prisma migrate deploy
I could open Prisma Studio without issue.
Are you using the latest Prisma version?Clément Guibout
09/20/2022, 7:47 PMAustin
09/20/2022, 7:53 PMnpx prisma db push
or npx prisma migrate dev
?Clément Guibout
09/20/2022, 7:56 PMClément Guibout
09/20/2022, 7:56 PMAustin
09/20/2022, 8:02 PMprisma migrate dev
actually generates a migration file and applies it to the current database.
prisma migrate deploy
does not generate migration files, it only applies those that are found in the migrations folder.
prisma db push
syncs your schema file directly to the database, without generating migration files. Database resets are likely in when using this command.
Have you double-checked your database to see if the _EventToUser
table actually exists?Clément Guibout
09/20/2022, 8:47 PMClément Guibout
09/20/2022, 8:48 PMClément Guibout
09/20/2022, 8:49 PMClément Guibout
09/20/2022, 8:49 PMAustin
09/21/2022, 7:32 PMClément Guibout
09/21/2022, 7:43 PM