Error validating: You defined the enum `UserRole`. But the current connector does not support enums.
Solution:Jump to solution
Looks like you're using sqlite. You can:
* have a UseRole table
* if your project isn't that complex/big, you can just just store it as a string
* isAdmin boolean (if that's all you'll need)?...
10 Replies
is it using sqlite connector ? as the error says, all connectors donot support enum. sqlite doesn't afaik
Solution
Looks like you're using sqlite. You can:
* have a UseRole table
* if your project isn't that complex/big, you can just just store it as a string
* isAdmin boolean (if that's all you'll need)?
@100xdev @amit13
Error validating model "User": Ambiguous relation detected. The fields
classes
and courses
in model User
both refer to Courses
. Please provide different relation names for them by adding `@relation(<name>).
What's the difference between courses and classes? How are you linking User.classes to Courses?
Also note that
coursesId String @unique
means two students cannot share one coursesIdeach course must have a teacher or instructor
The class in the user is for a student
I have removed the
@unique
for both model
@100xdev
I think I will take a different approach instead of me using a relationship system I will just Store the user ID in the course insteadLooks like you have a many-to-many relationship.
One User can have many courses (regardless teacher or student, that could be a userRole or isTeacher column)
so I have to add another model
what I did I have one relationship then I just store the ID of the user/teacher end the course
That makes sense for JSON, but for sqlite, I suggest having a separate table for the relationship.
And if a course can only be taught by one teacher, you can have
Courses.teacherId
that references the teacher user