Fyzz
Fyzz
Explore posts from servers
DTDrizzle Team
Created by Fyzz on 9/7/2024 in #help
Vector types/querys - Turso/LibSQL Support
Is there support for the vector features of libSQL in drizzle-orm? I can't seem to find it anywhere
4 replies
DTDrizzle Team
Created by Fyzz on 3/30/2024 in #help
Turso DB reads (alot)
No description
6 replies
DTDrizzle Team
Created by Fyzz on 9/5/2023 in #help
How would one go about caching in next 13 app router with db data
Im trying to cache the db call, trying to avoid making an api endpoint for each query and utilize server actions or just in file db calls on RSCs but the calls dont seem to cache correctly. Does anyone have an example of doing this correctly?
1 replies
DTDrizzle Team
Created by Fyzz on 8/30/2023 in #help
PostgreSQL "type serial does not exist"
I'm getting an error when using serial and primary key. Just trying out postgres for the first time so its very possible I messed something up, the serial type works perfect on non primary key fields
export const users = pgTable(
"users",
{
id: serial('id').primaryKey(),
clerk_id: varchar("user_id", { length: 50 }),
username: varchar("username", { length: 100 }),
},
(users) => {
return {
username_idx: uniqueIndex("username_idx").on(users.username),
};
}
);
export const users = pgTable(
"users",
{
id: serial('id').primaryKey(),
clerk_id: varchar("user_id", { length: 50 }),
username: varchar("username", { length: 100 }),
},
(users) => {
return {
username_idx: uniqueIndex("username_idx").on(users.username),
};
}
);
#this is the error displayed when try to push changes
error: type "serial" does not exist
#this is the error displayed when try to push changes
error: type "serial" does not exist
12 replies
DTDrizzle Team
Created by Fyzz on 8/11/2023 in #help
"mode" not defined in drizzle config 0.28.1
10 replies
DTDrizzle Team
Created by Fyzz on 8/6/2023 in #help
Relations not building into type
Im having an issue where the relations types are not correctly being tied to the table
const todaysVisits = await db.query.visits.findMany({
where: sql`DATE(${visits.date}) = ${date.format("YYYY-MM-DD")}`,
with: {
job: {
// getting type error here but the data is fetching correctly
where: eq(jobs.company_id, user.privateMetadata.company_id as string),
columns: {
instructions: true,
},
with: {
property: {
columns: {
nick_name: true,
address: true,
},
with: {
client: {
columns: {
full_name: true,
},
},
},
},
},
},
},
})
const todaysVisits = await db.query.visits.findMany({
where: sql`DATE(${visits.date}) = ${date.format("YYYY-MM-DD")}`,
with: {
job: {
// getting type error here but the data is fetching correctly
where: eq(jobs.company_id, user.privateMetadata.company_id as string),
columns: {
instructions: true,
},
with: {
property: {
columns: {
nick_name: true,
address: true,
},
with: {
client: {
columns: {
full_name: true,
},
},
},
},
},
},
},
})
then later when trying to use the data
<span>
// getting type any here too
{visit.job?.property?.address ?? ""}
</span>
<span>
// getting type any here too
{visit.job?.property?.address ?? ""}
</span>
1 replies
DTDrizzle Team
Created by Fyzz on 7/30/2023 in #help
Query a table based on related table
How do I go about querying a table of let’s say visits that each have a date and have a relation to a table called jobs where one job could have many visits, how would I go about getting visits based on a date range that only belong to a job with a given “company id” I know how to get them in the date range but I’m not sure how to go about having a date range and() related jobs company Id without also storing the company id in each visit
4 replies