DiamondDragon
Explore posts from serversDTDrizzle Team
•Created by DiamondDragon on 9/6/2024 in #help
Drizzle Zod refining not working?
Shouldn't this code for zod make an optional field
firstName
required?
https://drizzle.run/t2zowcjw5f1xbb5ny7zq2j3n3 replies
DTDrizzle Team
•Created by DiamondDragon on 8/31/2024 in #help
Dynamic function get use typed column names using getTableConfig
I have both UUIDs and NanoIDs on every one of my tables. I am considering adding utils to map from uuid -> nanoID & vice versa.
how would i make a dynamic function like this? basically under the assumption every table has a
id
and shortId
column which is the nanoid
1 replies
DTDrizzle Team
•Created by DiamondDragon on 6/20/2024 in #help
Use results of a column to pass where conditions elsewhere in the query?
I have a field that stores filters that I parse into the SQL conditions for a where clause. Or at least, that's the goal.
That field is in my views table. Is it possible to pass the result of that field in
views
into a nested where condition?
1 replies
DTDrizzle Team
•Created by DiamondDragon on 6/10/2024 in #help
construction a dynamic query builder generically ?
Ok i'm not really sure how to ask this but I'm trying to allow a user the ability in UI to build out a query builder where they can add many filters with potentially nested filters with AND/OR conjuctions. Like airtable.
Anyone have any patterns how to do this?
I had attempted to try to construct a mapping on the SQL operators and the drizzle functions but I can't get the types to work .
I'm playing aroung just with the
sql
operator to try making ti work with more raw SQL.
trying to wrap my head around this and its a pattern i've seen few apps implement and never seen any code online to use as a guide
Ideally a user can do a query in the UI like below and the queries can be constructed dynamically.
1 replies
DTDrizzle Team
•Created by DiamondDragon on 5/19/2024 in #help
Losing custom $types in pg jsonb using drizzle-zod
Not sure if this is an expected limitation of zod here
produces using $inferInsert
But when using drizzle zod, i lose RecordData
1 replies
DTDrizzle Team
•Created by DiamondDragon on 4/17/2024 in #help
Generated SQL error / type error with operations on unique index
1 replies
DTDrizzle Team
•Created by DiamondDragon on 4/16/2024 in #help
Drizzle studio shows as blank page on Arc browser
1 replies
DTDrizzle Team
•Created by DiamondDragon on 3/21/2024 in #help
bun:sqlite - why is my sqlite3 version mismatched?
I'm trying to better understand JSONB functionality in sqlite so i replaced the 3.43 version on my mac by default with 3.45 from homebrew. but noticed some version mismatch
the code I'm running using the bun:sqlite driver is
console.log(db.all(sql
SELECT sqlite_version()))
which returns 3.43 but as you can see below, in my terminal i have 3.45 installed. But i can't figure out why it's not working
when i go into the db from my project in vscode1 replies
DTDrizzle Team
•Created by DiamondDragon on 12/2/2023 in #help
createInsertSchema does not infer notNull() correclty?
"drizzle-orm": "^0.28.6",
"drizzle-zod": "^0.5.1",
Results
2 replies
DTDrizzle Team
•Created by DiamondDragon on 9/27/2023 in #help
Help with proper types (values)
2 replies
DTDrizzle Team
•Created by DiamondDragon on 9/23/2023 in #help
TypeError: client.unsafe is not a function
7 replies
DTDrizzle Team
•Created by DiamondDragon on 9/7/2023 in #help
No transactions support in neon-http driver even though neon provides a transaction function
https://neon.tech/docs/serverless/serverless-driver#when-to-use-the-neon-function-vs-pool-or-client
I tried to execute a db operation such as below. I am getting
throw new Error('No transactions support in neon-http driver');
I'm not sure if the kind of code below is an "interactive" or "non-interactive" transaction, but wondering if maybe I am missing something. Does drizzle support the neon(...) transaction()
function?
20 replies
DTDrizzle Team
•Created by DiamondDragon on 8/28/2023 in #help
Column Unique name appears to be incorrect when spreading common fields to multiple tables
25 replies
DTDrizzle Team
•Created by DiamondDragon on 8/22/2023 in #help
Custom type not inferring correct zod schema?
3 replies
DTDrizzle Team
•Created by DiamondDragon on 7/6/2023 in #help
Proper Way to Deal with Migration Failures and Rolling Back?
So I added an Enum and made a few minor changes and generated 3 SQL files. But when running a migration I got the error
on one of my created enums. It seemed like something bugged out where it wasn't creating the enum in the proper order? Anyway, I had to delete my snapshot json, SQL, and _journal files back to last working migration (#5) vs #8 where i was.
If i didn't manually delete the migrations in the array in _jounral i would get
throw new Error(
No file ${migrationPath} found in ${migrationFolderTo} folder)
error.
Not sure if there was a proper way of rolling back migrations but hopefully this manual approach helps anyone4 replies
DTDrizzle Team
•Created by DiamondDragon on 6/30/2023 in #help
Issue running migrations to DB
I am having an issue running migrations to Neon. I checked that everything is exporting const variables and tried add the cjs version of drizzle kit and reinstalling node modules.. but no luck fixing it
I also tried to run a migration on a new db and its still giving me the same error. not sure whats going on
3 replies
DTDrizzle Team
•Created by DiamondDragon on 6/29/2023 in #help
Migrations not working with Neon.Tech?
3 replies