Jsx
Jsx
Explore posts from servers
DTDrizzle Team
Created by Jsx on 3/24/2024 in #help
working with many to many
Okay so this is redundant coz I am again mapping courses to display so I can directly do this I can remove the courses array
{memberCourses?.map((memberCourse) => (
<div key={memberCourse.courseId} className="border-2 px-5 py-3">
<h3 className="text-xl font-medium">{memberCourse.course.title}</h3>
<Link href={`/dashboard/courses/${memberCourse.course.slug}/basic`}>
Manage
</Link>
</div>
))}
{memberCourses?.map((memberCourse) => (
<div key={memberCourse.courseId} className="border-2 px-5 py-3">
<h3 className="text-xl font-medium">{memberCourse.course.title}</h3>
<Link href={`/dashboard/courses/${memberCourse.course.slug}/basic`}>
Manage
</Link>
</div>
))}
3 replies
DTDrizzle Team
Created by Jsx on 3/24/2024 in #help
working with many to many
currently I am doing this
const memberCourses = await db.query.courseMember.findMany({
where: eq(courseMember.userId, currentUser.userId),
with: {
course: {
columns: {
id: true,
title: true,
slug: true,
},
},
},
});

const courses: CourseData[] = [];
memberCourses.forEach((orgCourse) => courses.push(orgCourse.course));
const memberCourses = await db.query.courseMember.findMany({
where: eq(courseMember.userId, currentUser.userId),
with: {
course: {
columns: {
id: true,
title: true,
slug: true,
},
},
},
});

const courses: CourseData[] = [];
memberCourses.forEach((orgCourse) => courses.push(orgCourse.course));
3 replies
DTDrizzle Team
Created by JWW on 12/10/2023 in #help
push command didn't update schema to my database (truso)
you have existing data so one thing you can do is to have a default value for deadline like null or empty string. You're providing the constraint that it should be not null but also not providing the default value. I don't know why didn't it throw any error as you mentioned
3 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
pg is required for runtime don't add it as dev dep You need it for client
20 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
Even for 0.29.1 it's working fine
20 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
Versions "drizzle-orm": "^0.29.0", "drizzle-kit": "^0.20.4", "pg": "^8.11.3",
20 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
I reconstructed the schema and I am not getting any error
20 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
Okay
20 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
all imports are from drizzle-orm/pg-core right? Can you check
20 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
Last 4th line I think you mean to reference id of admin table??
20 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
Btw why are you referencing adminId as users.id??
20 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
can you share complete schema file then only I will be able to figure out
20 replies
DTDrizzle Team
Created by Izaan on 12/8/2023 in #help
self reference error
You are getting this error while quering??
20 replies