desert
Explore posts from serversDTDrizzle Team
•Created by desert on 9/11/2023 in #help
Error using relational queries but not with core queries
when i do
everything works as intended, but when I do
it gives me: PostgresError: column "invites.created_at" must appear in the GROUP BY clause or be used in an aggregate function
relationships:
Thank you in advance <3
1 replies
DTDrizzle Team
•Created by desert on 8/21/2023 in #help
Using query builder with views
How do you use the query builder with views? typescripts yells at me saying that db.query.nameOfView is not defined.
Thank you in advance
4 replies
DTDrizzle Team
•Created by desert on 8/20/2023 in #help
Nested where clauses in relational queries
I have this query:
const asset = await db.query.assets.findFirst({
with: {
assetImages : true,
assetModeration: {
where: eq(assetsModerations.state, "ACCEPTED"), //this line gives error
columns: {
state: true,
},
}
},
where: (eq(assets.id, id))
})
that gives this error: Object literal may only specify known properties, and 'where' does not exist in type ...
the assetsModerations table looks like this:
export const assetsModerations = pgTable(
"assets_moderations",
{
id: serial('id').primaryKey(),
created_at: timestamp('created_at').notNull().defaultNow(),
description: text('description'),
moderatorId: text("moderator_id").references(() => users.id),
updatedAt: timestamp('updated_at'),
state: moderationState('moderation_state').notNull().default('PENDING')
}
)
this error is not given if i try to do the same with assetImages, the other table, what is the problem here?
Thank you in advance.
35 replies