Closed frankcollins3 closed 1 year ago
prisma/schema.ts:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("NEXT_PUBLIC_DATABASE_URL")
}
model users {
id Int @id @default(autoincrement())
google_id String?
icon String?
username String?
email String?
password String?
age Int?
settings settings[]
data data[]
}
model settings {
id Int @id @default(autoincrement())
users users @relation(fields: [id], references: [id])
age Int
height Int
weight Int
start_time Int
end_time Int
reminder Int
activity Int
users_id Int
}
model data {
id Int @id @default(autoincrement())
users users @relation(fields: [id], references: [id])
google_id String?
date String?
progress Int
weekday String?
status String[]
users_id Int
}
quick fix and the routes work more easily.. just had to: 👍 remove "id" field in prisma.data.create({
[10:33pm]
attempting to do: deploy. but now fix routes.
error: been using 3-4 pieces of data at a time for 3-4 users. user can only have 1 settings, if they add settings it updates them. {psql.data} is water-cycle data. settings decides weight and height and intake formula and schedule from which data is based.
data.id is corresponding to the user when it should be users_id. this hasn't been a problem having 3-4 days to a user
proposed approach: dismantle prisma and reconfigure.