DYELbrah
Explore posts from serversDTDrizzle Team
•Created by DYELbrah on 10/19/2024 in #help
DrizzleKit check constraint generation missing value
I added a constraint to this table:
This generated the following SQL in the migration file. You can see that $1 was returned which should have been a 0, since the minimum is 0. This then leads to failing migrations.
This leads to:
Error during migration: NeonDbError: there is no parameter $1
Is this a known bug?
6 replies
DTDrizzle Team
•Created by DYELbrah on 6/2/2024 in #help
Is it okay to manually edit migration files?
I recently had a migration file execute commands for dropping a table in the wrong order. Can I reorder them manually? This wouldn't result in any schema changes technically....
2 replies
DTDrizzle Team
•Created by DYELbrah on 6/2/2024 in #help
Can't apply migration?
The following migration file was generated by Drizzle-Kit
I basically just dropped a table called worker_pay_period, this table was referenced inside my pay_stub table (hence why the last command deletes the FK column)
For some reason when this executes I get:
If I'm not mistaken, Drizzle-Kit should've dropped the column inside the pay_stub table that references the dropped table. Is this a bug? Can I manually update the migration file to do this or would this cause issues?
1 replies
DTDrizzle Team
•Created by DYELbrah on 6/1/2024 in #help
Updated Drizzle Kit and now all indexes were updated to use Btree? Why?
Today I generated a migration after updating drizzle-kit to ^0.22.1
It seems to have dropped all my previous indexes:
Such as one that I created before the updated which generated:
The new migration file did:
Here's how that table with the index is defined in case that's useful
Why did this happen?
1 replies
DTDrizzle Team
•Created by DYELbrah on 5/28/2024 in #help
Drizzle-kit detecting random enums?
Why am I getting this interactive prompt? How can I force select the first option?
I get this when I run drizzle-kit push using pg.
1 replies
DTDrizzle Team
•Created by DYELbrah on 5/28/2024 in #help
Drizzle-kit push remove interactivity?
In our GH Actions we're getting the following prompt:
enum name created or renamed from another enum?
Then we have to select a value, how can we stop this from happening as it's breaking our actions?
1 replies
TTCTheo's Typesafe Cult
•Created by DYELbrah on 4/14/2024 in #questions
How to exclude specific routes from Clerk middleware?
Anyone know how I can exclude the middleware from Clerk from running on my routes in folder: /api/cron?
Here's the current file:
I believe we need to update the matcher but not sure how to do it correctly.
3 replies
DTDrizzle Team
•Created by DYELbrah on 4/5/2024 in #help
Is there anyway we can add middleware to a table to execute before update or insert?
Similar to check constraints, I'd like to be able to execute a function before a record is updated or inserted into a specific table. Ideally these functions would be defined on the drizzle db schema? Not sure if this is possible?
1 replies
DTDrizzle Team
•Created by DYELbrah on 3/16/2024 in #help
Will Drizzle throw when we attempt to update and zero records where updated?
Lets say we have a query where we update where id = input.id.
If there was no row where that criteria is met, will Drizzle throw? or will it go through?
Thanks!
3 replies
DTDrizzle Team
•Created by DYELbrah on 3/12/2024 in #help
What is the import { check } used for from from "drizzle-orm/pg-core"
Anyone know what the check function imported from "drizzle-orm/pg-core" does?
I believe check constraints are still not implemented so I'm not sure?
Here's what it's definition looks like:
4 replies
DTDrizzle Team
•Created by DYELbrah on 3/6/2024 in #help
If we're using Drizzlekit push, do we need to ever generate migrations?
Is there anywhere I can explain what the migration scripts are for? When I push a change, can't we just db:push our current version and that's it? What's the point of ever generating a migration file?
1 replies
TTCTheo's Typesafe Cult
•Created by DYELbrah on 3/6/2024 in #questions
Inside create t3 app with Drizzle, why do we pass the database through ctx on each procedure?
If I'm not mistaken, we ideally don't want to do this if we want to break our application into separate layers (One of them being a data acess layer that we use to connect to our database).
Would there be an issue if I remove this from the context and just import the db directly from the src/server/db/index.ts file?
Default way of doing this in T3:
What I would rather do:
Here's how it's being added to context now, I'd rather not use this? I feel like it's there for a reason though and I can't figure out why 😦
11 replies
DTDrizzle Team
•Created by DYELbrah on 12/22/2023 in #help
$with using sql operator doesn't return type?
Whenever I make a call to this table using db.with(companiesWithPrimaryAddress)
the type of primaryAddress is returned as 'never'? Anyone know why?
6 replies
DTDrizzle Team
•Created by DYELbrah on 9/10/2023 in #help
Expected 1 arguments, but got 2.ts(2554)
Anyone know why I'm getting this type error?
2 replies
DTDrizzle Team
•Created by DYELbrah on 9/7/2023 in #help
Timestamp from Postgres returns date object despite schema using string mode?
Hello team, I'm confused if this is a bug because I haven't seen any other threads about it.
When I define my timestamp columns like this:
How come the return type of the column when I fetch data says string, however when I log the value or use it anywhere, it's actually a JS date object?
Is this a known issue?
15 replies
DTDrizzle Team
•Created by DYELbrah on 9/4/2023 in #help
Does throwing a regular javascript error inside a transaction, roll back automatically?
Curious if I need to actually call tx.rollback()? Or if we reach a regular error, or lets say a Postgres error occurs at some step, will everything be automatically rolled back?
Or do we have to always try catch and rollback in the catch/finally block?
3 replies
DTDrizzle Team
•Created by DYELbrah on 8/19/2023 in #help
date column not being returned as string by drizzle
Hello, I have the following table:
Whenever I try to query the effectiveDate from the drizzle table, TypeScript says the return type will be string, however, I verified that I am actually receiving a Date object. I am using mode 'string' as you can see. Is this a known issue?
9 replies
DTDrizzle Team
•Created by DYELbrah on 8/14/2023 in #help
table not being camelcased when using joins?
For some reason when I use the following query:
I am geting the following type back:
Why is the name of the table not being camel cased?
12 replies
TTCTheo's Typesafe Cult
•Created by DYELbrah on 7/24/2023 in #questions
DI libraries and using Singletons in NextJS / T3?
Hey guys, I'm just curious if I'm using a Dependency Injection (DI) library within the T3 stack (using NextJS + TRPC), is there any benefit at all to using services as singletons?
Wouldn't my container definitions and everything basically just get restarted for every request, thus not really mattering since the same instance won't be used?
2 replies
TTCTheo's Typesafe Cult
•Created by DYELbrah on 7/18/2023 in #questions
Fresh T3 install, auth.ts error: "next-auth" has no exported member getServerSession ???
Anyone know why I'm getting this typescript error was the function deprecated or removed recently?
3 replies