Huge Letters
Huge Letters
Explore posts from servers
DTDrizzle Team
Created by Vinny on 4/8/2024 in #help
Using sql.placeholder with limit in creating a prepared query
you could put as never there for now to test it
14 replies
DTDrizzle Team
Created by Vinny on 4/8/2024 in #help
Using sql.placeholder with limit in creating a prepared query
does it work tho? is it just a typescript error or query also doesn't work? if it's only a TS problem it's pretty easy fix - you could patch it temporarily while waiting for an update
14 replies
DTDrizzle Team
Created by Vinny on 4/8/2024 in #help
Using sql.placeholder with limit in creating a prepared query
so I think you can file an issue on gh
14 replies
DTDrizzle Team
Created by Vinny on 4/8/2024 in #help
Using sql.placeholder with limit in creating a prepared query
No description
14 replies
DTDrizzle Team
Created by Vinny on 4/8/2024 in #help
Using sql.placeholder with limit in creating a prepared query
No description
14 replies
DTDrizzle Team
Created by Headless on 4/8/2024 in #help
Issues with NextJS + Turso + DrizzleORM + LuciaAuth
i would check your nextjs(or webpack?) config first - maybe there is some setting to parse .md files(however your logs also indicate license files to be compiled) and it wasn't properly set up and this issue popped up now if not - i would ask in nextjs repo/discord server first. seems more like their issue than libsql
13 replies
DTDrizzle Team
Created by Vinny on 4/8/2024 in #help
Using sql.placeholder with limit in creating a prepared query
what drizzle version and driver are you using? i've tried this just now on the latest version with sqlite - no issues
14 replies
DTDrizzle Team
Created by Headless on 4/8/2024 in #help
Issues with NextJS + Turso + DrizzleORM + LuciaAuth
well it seems like nextjs is trying to compile readme files lol so this is either a nextjs or libsql client issue - either something wrong with nextjs build system or libsql client provides incorrect export maybe i dunno
13 replies
DTDrizzle Team
Created by tsuki on 4/8/2024 in #help
trying to create a trigger on supabase to calculate a winrate based on two other columns
btw even tho this is unwarranted advice - is winrate column even needed? you could always compute it pretty easily on demand from the other two, no?
6 replies
DTDrizzle Team
Created by tsuki on 4/8/2024 in #help
trying to create a trigger on supabase to calculate a winrate based on two other columns
you are dividing two ints - you get an int as a result(rounded down). 6 / (6 + 4) * 100 -> 6 / 10 * 100 -> 0 * 100 multiply new.wins by 1.0 (not just 1) - should help. or do a coalesce to float on one of columns new.winrate = ((1.0 * new.wins) / (new.wins + new.losses)) * 100;
6 replies
DTDrizzle Team
Created by Null on 4/8/2024 in #help
Using drizzle in docker gives [i] No changes detected
also try checking what's inside of var/Bun/drizzle where your migrations are - perhaps your image already has them?
4 replies
DTDrizzle Team
Created by Null on 4/8/2024 in #help
Using drizzle in docker gives [i] No changes detected
sorry, since you're using bun so use their alternatives - pretty sure they have something similar as well
4 replies
DTDrizzle Team
Created by Null on 4/8/2024 in #help
Using drizzle in docker gives [i] No changes detected
try logging process.cwd() and readDir of schema folder maybe from node inside drizzle.config.ts - I think it would make it more clear if inside the image this path is correct or not
4 replies
DTDrizzle Team
Created by Titan on 4/8/2024 in #help
Insert returning api to match select columns
what's the purpose of true in select object? why it doesn't just contain relevant columns like in returning object?
8 replies
DTDrizzle Team
Created by Huge Letters on 4/6/2024 in #help
Generate SQL statements with Drizzle
In case anyone would stumble upon this and find that useful - here's a gist with results you can use that to create triggers with drizzle and run a script to generate a new migration file with those triggers https://gist.github.com/HugeLetters/7cce16a0f57b612507c7e17a9b4e688e
4 replies
DTDrizzle Team
Created by andreas_444 on 4/4/2024 in #help
Object literal may only specify known properties, and photo does not exist in type
in that case I think you're correct and that's an error with type definition you could file an issue on github but I don't know if this is gonna be a priority - you could fix the select easily like this but it won't infer result type correctly and fixing that seems to be much more complicated, at least at the first glance for me
// /node_modules/drizzle-orm/operations.d.ts

// from
export type SelectedFieldsFlat<TColumn extends Column> = Record<string, TColumn | SQL | SQL.Aliased>;
// to
export type SelectedFieldsFlat<TColumn extends Column> = Record<string, TColumn | SQL | SQL.Aliased | SelectedFieldsFlat<TColumn>>;
// /node_modules/drizzle-orm/operations.d.ts

// from
export type SelectedFieldsFlat<TColumn extends Column> = Record<string, TColumn | SQL | SQL.Aliased>;
// to
export type SelectedFieldsFlat<TColumn extends Column> = Record<string, TColumn | SQL | SQL.Aliased | SelectedFieldsFlat<TColumn>>;
17 replies
DTDrizzle Team
Created by janat08 on 9/17/2023 in #help
turso geospatial and fuzzy search using extensions
I'm just guessing but I would assume the steps are: 1) https://orm.drizzle.team/docs/get-started-sqlite#better-sqlite3 - you create your db connection with better-sqlite3 2) https://github.com/nalgeon/sqlean/blob/main/docs/install.md#install-nodejs - here sqlean have docs on how to load extension with better-sqlite3 3) then you just use sql "magic" operator to do direct queries like select soundex('hello');
db.run(sql`select soundex('hello')`)
db.run(sql`select soundex('hello')`)
or something like that
4 replies
DTDrizzle Team
Created by AndréLB on 4/7/2024 in #help
Best way to use select in a function that is returning a specific type
if users.userID is a column on users table then select works correctly - it returns user id(1) on the field userID select returns an array of values - you take the first one. seems correct.
await db.select({ userID: users.userID }) // Array<{userID: number }>
await db.select({ userID: users.userID }) // Array<{userID: number }>
2 replies