Timo
Timo
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
thank you again.
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
i solved it
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
ok
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
thank you, but now I have the error: Cannot read properties of undefined (reading 'referencedTable') ...
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
are you having some success?
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
thank you
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
because the error does not disappear
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
or what?
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
should I reset the database?
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
and then?
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
relationName? I am not used to it
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
could you please show me an example?
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
I don't know it ...
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
😉
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
you will be able to see what the problem is
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
//// Friendship Model
export const friendships = pgTable(
'friendships',
{
userId: uuid('user_id').references(() => users.id),
anotherUserId: uuid('another_user_id').references(() => users.id),
createdAt: timestamp('created_at').notNull().defaultNow()
},
(table) => ({
primaryKey: primaryKey({
columns: [table.userId, table.anotherUserId]
})
})
)

//// Friendship Relations
export const friendshipsRelations = relations(friendships, ({ one }) => ({
user: one(users, {
fields: [friendships.userId],
references: [users.id]
}),
anotherUser: one(users, {
fields: [friendships.anotherUserId],
references: [users.id]
})
}))
//// Friendship Model
export const friendships = pgTable(
'friendships',
{
userId: uuid('user_id').references(() => users.id),
anotherUserId: uuid('another_user_id').references(() => users.id),
createdAt: timestamp('created_at').notNull().defaultNow()
},
(table) => ({
primaryKey: primaryKey({
columns: [table.userId, table.anotherUserId]
})
})
)

//// Friendship Relations
export const friendshipsRelations = relations(friendships, ({ one }) => ({
user: one(users, {
fields: [friendships.userId],
references: [users.id]
}),
anotherUser: one(users, {
fields: [friendships.anotherUserId],
references: [users.id]
})
}))
this is the data model
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
this is the error
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
here
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
Error: There are multiple relations between "friendships" and "users". Please specify relation name
32 replies
DTDrizzle Team
Created by Timo on 7/19/2024 in #help
Query causes error
user is never set
32 replies