AstroBear
AstroBear
DTDrizzle Team
Created by AstroBear on 1/30/2024 in #help
Do transaction automatically rollback on error?
Thanks, I also tested it and throwing any kind of error makes the transaction rollback 🙂
5 replies
DTDrizzle Team
Created by daniel_uc on 1/26/2024 in #help
Is this error in Docs for drizzle-kit Running Migrations SQLite
Yeah, sqlite migrate is synchronous and no await is necessary. Then I guess you might be right and could ask on GitHub about this 😀
7 replies
DTDrizzle Team
Created by daniel_uc on 1/26/2024 in #help
Is this error in Docs for drizzle-kit Running Migrations SQLite
Oh wait, maybe the migrate for sqlite is synchronous?
7 replies
DTDrizzle Team
Created by daniel_uc on 1/26/2024 in #help
Is this error in Docs for drizzle-kit Running Migrations SQLite
Try to use await and see how it goes. It seems weird it is not used there..
7 replies
DTDrizzle Team
Created by AstroBear on 1/26/2024 in #help
Why does `sum` return `SQL<string | null>`?
Got it, ty. I guess it is mapped to String for some sort of compatibility.
10 replies
DTDrizzle Team
Created by AstroBear on 1/26/2024 in #help
Why does `sum` return `SQL<string | null>`?
Thanks, I was using the drizzle sum agg helper. I ended up just using Number() at the end, but I was wondering why it was decided it had to return a string
10 replies
DTDrizzle Team
Created by alka_99 on 1/26/2024 in #help
How to access multiple relations in query
Because:
export const contentRelations = relations(property, ({ one }) => ({
content: one(content,{
fields: [property.id],
references: [content.property_id]
})
}))
export const contentRelations = relations(property, ({ one }) => ({
content: one(content,{
fields: [property.id],
references: [content.property_id]
})
}))
is actually a property relation (see relations(property, ...), while:
export const priceRelations = relations(price, ({ one }) => ({
property: one(property,{
fields: [price.property_id],
references: [property.id]
})
}))
export const priceRelations = relations(price, ({ one }) => ({
property: one(property,{
fields: [price.property_id],
references: [property.id]
})
}))
is a price relation. You need to fix contentRelations and create a new propertyRelations that references both content and price
6 replies
DTDrizzle Team
Created by Alvee on 1/25/2024 in #help
can I run migration without drizzle-kit generate:mysql just from code
migrate should just apply all the migrations in the specified folder to the connected database. drizzle-kit generate:mysql generates a new SQL migration file. They are two separate things
2 replies
DTDrizzle Team
Created by daniel_uc on 1/26/2024 in #help
Is this error in Docs for drizzle-kit Running Migrations SQLite
Did you use await when using migrate? It may close the connection before the action is executed. The connection is closed otherwise the script might hung
7 replies
DTDrizzle Team
Created by jmandrosz on 1/26/2024 in #help
Relations in schema
Yes, I think relations are only used in "queries" (prisma-like selects). You don't need them when using selects
4 replies
DTDrizzle Team
Created by AstroBear on 1/11/2024 in #help
Using `count` in CTE has type `never`
Fixed, I had to use countDistinct(following.followingId).as('following') etc.
2 replies
DTDrizzle Team
Created by AstroBear on 1/8/2024 in #help
Include count of relations
Nice, thank you!
3 replies