I am currently working on a project and using nextjs, postgres+ prisma.
I used Supabase to create databse and used the link in my .env to connect the databse with my prisma schema.
When I am running migrate command, there is no error in terminal, and it gets connected to database, but after few minutes it gives an error on Supabase Logs section :
“Tenant has no connected users, database connection will be terminated”.
I rechecked everything, my connection gets established but I am unable to understand the cause behind this disconnection.
I am attaching few screenshots, please view them for better understanding:
Real Time Log section on Supabase Dashboard
Pooler log section
Database connection Status
This is the schema file I have written, and the Database URL is saved in .env file.
I updated all my libraries but there was no change.
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
address String @unique
tasks Task[]
}
model Worker {
id Int @id @default(autoincrement())
address String @unique
submissions Submission[]
balance_id Int
pending_amount Int
locked_amount Int
}
model Task{
id Int @id @default(autoincrement())
title String
user_id Int
user User @relation(fields: [user_id], references: [id])
options Option[]
submissions Submission[]
signature String
amount String
}
model Option {
id Int @id @default(autoincrement())
image_url String
option_id Int
task_id Int
task Task @relation(fields: [task_id], references: [id])
submissions Submission[]
}
model Submission{
id Int @id @default(autoincrement())
worker_id Int
worker Worker @relation(fields: [worker_id], references: [id])
option_id Int
option Option @relation(fields: [option_id], references: [id])
task_id Int
task Task @relation(fields: [task_id], references: [id])
amount String
}