Long names for relations are not supported?

here is all relations:
export const medMembersExaminationsRelations = relations(medMembersExaminations, ({many, one}) => ({
longNameLongNameLongName: one(medCommissionMembers, {
fields: [medMembersExaminations.medCommissionMemberId],
references: [medCommissionMembers.id]
})
}))

export const medCommissionMembersRelations = relations(medCommissionMembers, ({ one, many }) => ({
users: one(users, { fields: [medCommissionMembers.userId], references: [users.id] }),
medMemberExaminations: many(medMembersExaminations),
}));

export const usersRelations = relations(users, ({ many }) => ({
userOrganizations: many(userOrganizations),
medCommissionMembers: many(medCommissionMembers),
}));

export const userOrganizationsRelations = relations(userOrganizations, ({ one }) => ({
organization: one(organizations, {
fields: [userOrganizations.organizationId],
references: [organizations.id],
}),
user: one(users, {
fields: [userOrganizations.userId],
references: [users.id],
}),
}));
export const medMembersExaminationsRelations = relations(medMembersExaminations, ({many, one}) => ({
longNameLongNameLongName: one(medCommissionMembers, {
fields: [medMembersExaminations.medCommissionMemberId],
references: [medCommissionMembers.id]
})
}))

export const medCommissionMembersRelations = relations(medCommissionMembers, ({ one, many }) => ({
users: one(users, { fields: [medCommissionMembers.userId], references: [users.id] }),
medMemberExaminations: many(medMembersExaminations),
}));

export const usersRelations = relations(users, ({ many }) => ({
userOrganizations: many(userOrganizations),
medCommissionMembers: many(medCommissionMembers),
}));

export const userOrganizationsRelations = relations(userOrganizations, ({ one }) => ({
organization: one(organizations, {
fields: [userOrganizations.organizationId],
references: [organizations.id],
}),
user: one(users, {
fields: [userOrganizations.userId],
references: [users.id],
}),
}));
Here is my request
await db.query.medMembersExaminations.findMany({
with: {
longNameLongNameLongName: {
with: {
users: {
with: {
userOrganizations: {
with: { organization: true },
},
},
},
},
},
},
});
await db.query.medMembersExaminations.findMany({
with: {
longNameLongNameLongName: {
with: {
users: {
with: {
userOrganizations: {
with: { organization: true },
},
},
},
},
},
},
});
I got this error: column medMembersExaminations_longNameLongNameLongName_users_userOrgan.organization_id does not exist But when i use short names, like this:
export const medMembersExaminationsRelations = relations(medMembersExaminations, ({many, one}) => ({
short: one(medCommissionMembers, {
fields: [medMembersExaminations.medCommissionMemberId],
references: [medCommissionMembers.id]
})
}))
export const medMembersExaminationsRelations = relations(medMembersExaminations, ({many, one}) => ({
short: one(medCommissionMembers, {
fields: [medMembersExaminations.medCommissionMemberId],
references: [medCommissionMembers.id]
})
}))
It works. Can someone explain me pls?
1 Reply
Нарбек
НарбекOP11mo ago
Want results from more Discord servers?
Add your server