ippo
ippo
Explore posts from servers
DTDrizzle Team
Created by ippo on 5/8/2024 in #help
automatic flatten nested query result
@Angelelz thanks!
3 replies
DTDrizzle Team
Created by ippo on 9/15/2023 in #help
TRIGGERS in Drizzle
yep, just insert the SQL in the generated SQL that drizzle is giving you
13 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
can you clearify that AND can you tell me if this is possible to it with findMany?
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
@Angelelz : no, I had this query before but I do not understand your thing with the "Crud API"
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
@Angelelz sure this query reduced the phonenumbers into a single value. So with other words users[0].number is just a string:
return db
.select({
id: contacts.id,
firstName: contacts.firstName,
lastName: contacts.lastName,
number: phoneNumbers.number,
})
.from(contacts)
.leftJoin(phoneNumbers, eq(contacts.id, phoneNumbers.contactId));
return db
.select({
id: contacts.id,
firstName: contacts.firstName,
lastName: contacts.lastName,
number: phoneNumbers.number,
})
.from(contacts)
.leftJoin(phoneNumbers, eq(contacts.id, phoneNumbers.contactId));
is there a way to do that with .findMany() ?
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
@Angelelz I was able to do that with the sql-like syntax
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
you mean I can not use pure SQL that can reduce it to a single value?
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
hmm...
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
what I want is single string with other words:
typeof result.users[0].posts === "string" // true
typeof result.users[0].posts === "string" // true
makes sense 🙂 ?
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
@Angelelz this will give you an array of a single object
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
but how can I format the picked row?
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
I know that I can use where to select a specific post and limit to pick only one
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
@Angelelz how can I tell drizzle, to put a single value in posts? for example:
const result = await db.query.users.findMany({
with: {
posts: posts.content // <----only the first post should be fetched and only a string should be returned
},
});
const result = await db.query.users.findMany({
with: {
posts: posts.content // <----only the first post should be fetched and only a string should be returned
},
});
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
thanks for now, when there is query that I need to translate drizzle, I will let you know 🙂
25 replies
DTDrizzle Team
Created by ippo on 9/28/2023 in #help
one to many query
@Angelelz thanks for response! I just studied what sql is doing, and believe it or not, it just creates the same SQL that you would write in pure SQL to get the same result tired this cases it uses json functions to aggregate the children in a single field so a the moment I am able to get the most efficient query with the relational query
25 replies
DTDrizzle Team
Created by ippo on 9/15/2023 in #help
TRIGGERS in Drizzle
I will give it a try
13 replies
DTDrizzle Team
Created by ippo on 9/15/2023 in #help
TRIGGERS in Drizzle
🤔
13 replies
DTDrizzle Team
Created by ippo on 9/15/2023 in #help
TRIGGERS in Drizzle
I guess I have to use db.execute() in my migration.ts file?
13 replies
TtRPC
Created by ippo on 8/23/2023 in #❓-help
fetch failed - error on npm start on production
fixed the problem: fetch() was missing inside httpBatchLink this was missing:
// ...
httpBatchLink({
url: getUrl(),
fetch(url, options) {
return fetch(url, {
...options,
credentials: "include",
});
},
}),
// ...
// ...
httpBatchLink({
url: getUrl(),
fetch(url, options) {
return fetch(url, {
...options,
credentials: "include",
});
},
}),
// ...
3 replies