samson
Explore posts from serversDTDrizzle Team
•Created by pax on 4/26/2024 in #help
Querying a materialized view: relation does not exist
been running into the same problem, did you figure this out @pax ?
4 replies
DTDrizzle Team
•Created by seckraken on 6/14/2024 in #help
Create a view with Drizzle
Running into the same problem. Did you figure this out?
8 replies
DTDrizzle Team
•Created by DYELbrah on 6/2/2024 in #help
Is it okay to manually edit migration files?
yes why not. A migration file is just a list of commands that is executed upon calling the file.
2 replies
DTDrizzle Team
•Created by megamindat on 5/10/2024 in #help
No overload matches this call
Hard to tell what's going on here in the first place, but I'd inspect the
For debugging purposes, try passing a hardcoded object to
newwwRestaurant
object to see if there are any properties missing compared to your restaurant table.For debugging purposes, try passing a hardcoded object to
.values(...)
-- then work on making sure the result from your Zod-parse is identical in shape to that object.
Sorry, hard to debug this for me without looking at all the types that get created at these various steps.8 replies
DTDrizzle Team
•Created by ibet on 5/9/2024 in #help
Drizzle & Postgres JS - "postgres is not a function"
If you're using Next, then I'd try and check your server/client components. Are you declaring them correctly? I usually see this error when trying to use a function that should be in a server component (e.g.
db.query....
inside a client component.3 replies
DTDrizzle Team
•Created by kiryl_ch on 5/10/2024 in #help
how to query based on relation?
your where statement could look something like this. Hard to tell without your exact schema.
or you can do a
leftJoin()
and filter at that point:
2 replies
DTDrizzle Team
•Created by megamindat on 5/10/2024 in #help
No overload matches this call
Can you share how you define the actual table for
restaurant
?
createInsertSchema
is a helper to create a zod object. It doesn't create the database schema (not sure if you thought it would).8 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
just trying to lay out the logical steps
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
yeah totally
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
I generally
1. create a new column (
myColumn_NEW
)
2. copy over all the data (may need to cast/transform the data)
3. then drop the old column
4.then rename the new column.
1, 3, 4 are each migrations82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
depends on what the old vs new type is. Imagine you change from string to number -- that won't work
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
So I don't think this is something you need to know "how to fix"
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
Changing the type of an ID is kind of a complicated thing -- you might reference that same ID in other tables and be using the wrong type when you reference it. That may cause an error.
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
Does it have "ALTER..." in it?
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
all good- as ColdRiver said, check your migration file
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
I think ALTERING ids is not a good idea in general
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
to give you some context, what happens under the hood is that Drizzle executes all your migration files one by one, from start to finish.
You probably just have one file right now. And if you did what I suggested (drop all migrations, then generate one fresh one), then there's no need to add any SQL to it, since the file will have the correct type for your id.
For your change to be reflected in your production database, you need to probably tell Vercel to re-run your migration files -- I'm not familiar with how to trigger this on Vercel's end, it might be that you just connect your Github account or whatever and it detects any changes.
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
lastly you want push that change up to your database, ie run all migration files-- that kind of depends on what service you're using to host your DB.
82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
I would drop all migrations, and start from scratch
drizzle-kit drop
(multiple times if you have multiple migration files)
then
drizzle-kit generate:pg
to get a fresh migration file82 replies
DTDrizzle Team
•Created by David L. Bowman on 5/6/2024 in #help
Changing `id` type from serial to uuid, causing error.
serial
is a different type than uuid
- as the error message suggests you could cast it.
Like @ColdRiver suggests you could just change the migration assuming you're not in production yet? I would probably just reset the db schema if you're still in dev.82 replies