Sillvva
DTDrizzle Team
•Created by ArChak on 7/5/2024 in #help
How to check user input is a valid column before appending condition?
![No description](https://cdn.answeroverflow.com/1258625320441876593/CleanShot_2024-07-04_at_22.27.222x.jpg)
4 replies
DTDrizzle Team
•Created by ArChak on 7/5/2024 in #help
How to check user input is a valid column before appending condition?
Can you show the how you defined the columnFilters variable?
4 replies
DTDrizzle Team
•Created by magicspon on 7/4/2024 in #help
How to query many to many? Are the docs out of date?
Alternatively
7 replies
DTDrizzle Team
•Created by magicspon on 7/4/2024 in #help
How to query many to many? Are the docs out of date?
You should change the relation key
The key used in the rqb object should match the relation key
7 replies
DTDrizzle Team
•Created by Kenpaffu on 6/25/2024 in #help
insert multiple rows - onConflictDoUpdate
This guide provides helpful info on how to upsert multiple rows.
https://orm.drizzle.team/learn/guides/upsert
2 replies
DTDrizzle Team
•Created by Tobias on 6/25/2024 in #help
Insert returning and left join
returning
is not a SELECT query. It's part of the INSERT query.
In PostgreSQL you could do an INSERT inside a CTE, but not in SQLite. And even then, drizzle doesn't natively support that.3 replies
DTDrizzle Team
•Created by dp on 6/23/2024 in #help
Way to get relations via typeof someSchema.$inferSelect?
You can do it that way. You can also use this custom helper type.
Then you use it like this. First parameter is base table name, second is the same query object drizzle users for relational queries.
4 replies
DTDrizzle Team
•Created by noahsolomon on 6/18/2024 in #help
Where clause dependent on with relation
You can use the
exists
filter and a subquery:
https://orm.drizzle.team/docs/operators#exists
Something like this:
4 replies
DTDrizzle Team
•Created by Einzi on 6/15/2024 in #help
Array of Objects
Also might be worth adding something like this on the schema definition for type inference
.$type<{ foo: string }>()
6 replies
DTDrizzle Team
•Created by Eddy Vinck on 6/13/2024 in #help
How to do an UPDATE with a JOIN in Drizzle ORM?
You don't need the
.getSQL()
on the subquery5 replies
DTDrizzle Team
•Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
Yeah, I can't see any issue with that. I can't think of anything else off the top of my head, unfortunately.
13 replies
DTDrizzle Team
•Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
The values you're inserting also includes the
financialAccountId
?13 replies
DTDrizzle Team
•Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
Hmm, it should work so long as the conflict target is unique by its definition/constraints.
13 replies
DTDrizzle Team
•Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
Do you have a
unique
constraint on organisationId
and financialAccountId
?13 replies
DTDrizzle Team
•Created by xvx on 6/12/2024 in #help
How to dynamically set a row value using data from a JS object? (onConflictDoUpdate)
13 replies
DTDrizzle Team
•Created by Caspian Nightworth on 6/11/2024 in #help
Convert PostgreSQL to Drizzle ORM
This might work:
https://orm.drizzle.team/docs/select#select-from-subquery
And if you want all columns from spells, you can also do this:
4 replies
DTDrizzle Team
•Created by Headless on 6/10/2024 in #help
Typescript Error
That shows a type like:
And you can keep following the type definitions
9 replies