Ramazan
Ramazan
Explore posts from servers
DTDrizzle Team
Created by Ramazan on 9/20/2023 in #help
Prepend raw fields with table/subquery name in rendered SQL
That doesn't quite work in my case, where the raw sql field is in a subquery/CTE and collides with the name of of another table/subquery/cte. You have to prefix it with the subquery/CTE name manually every time it's used or keep track of and use different names for every such field like .as("balances_date") and .as("transaction_date").
6 replies
DTDrizzle Team
Created by binajmen on 8/7/2023 in #help
Is it possible to have nested values when doing a leftJoin?
You can do something like
export async function getLoansLJ(spaceId: string) {
return db
.select({ …getTableColumns(loans), financialInstitution: getTableColumns(financialInstitutions) })
.from(loans)
.leftJoin(
financialInstitutions,
eq(financialInstitutions.id, loans.financialInstitutionId)
)
.where(eq(loans.spaceId, spaceId));
}
export async function getLoansLJ(spaceId: string) {
return db
.select({ …getTableColumns(loans), financialInstitution: getTableColumns(financialInstitutions) })
.from(loans)
.leftJoin(
financialInstitutions,
eq(financialInstitutions.id, loans.financialInstitutionId)
)
.where(eq(loans.spaceId, spaceId));
}
You can find this in the docs towards the end of this section
33 replies
DTDrizzle Team
Created by Luxaritas on 4/11/2023 in #help
Typescript build fails with large number of columns
My two biggest issues with drizzle fixed in one patch, way to go lol
195 replies
DTDrizzle Team
Created by jakeleventhal on 7/3/2023 in #help
Why is introspecting creating tables that didn't previously exist
Replied in the issue
4 replies
DTDrizzle Team
Created by josephlyons on 5/31/2023 in #help
Can drizzle generate an initial schema from an existing db?
3 replies