PGT
DTDrizzle Team
•Created by PGT on 7/19/2024 in #help
migration fail when table exists
I have a table
messages
that is created in an earlier migration file:
In a subsequent migration, I add a column to this table:
Both of these .sql
files were generated with drizzle-kit generate --config=drizzle.config.ts
On a completely fresh DB, running drizzle-kit migrate --config=drizzle.config.ts
gets an error:
1 replies
DTDrizzle Team
•Created by PGT on 12/6/2023 in #help
drizzle-kit not detecting tsconfig and getting path alias '~/'
When I try to default to a TS enum, drizzle-kit push fails when i run
drizzle-kit push:pg --config=drizzle.config.ts
If I just remove the .default(PDF_PARSE_STATUS.PENDING)
in my schema (but keep the import import { PDF_PARSE_STATUS } from '~/types';
), it will succeed
Here's my code:
schema.ts
types.ts
drizzle.config.ts
10 replies
DTDrizzle Team
•Created by PGT on 11/17/2023 in #help
varchar but cast to typescript enum?
I have the following table:
The type of this field will be string. I don't want to use a db enum, but I want to automatically define the type of this field as
type STATUS
, which is a TS enum.
How would I do this?4 replies
DTDrizzle Team
•Created by PGT on 9/29/2023 in #help
update where multiple conditions
Trying to do something like a:
UPDATE table SET values WHERE condition1 AND condition2
other ORMs will all you to pass in an object for conditions and they'll handle it under the hood, does Drizzle have something like this or do I need to do something like:
27 replies
DTDrizzle Team
•Created by PGT on 9/24/2023 in #help
update a nested jsonb field
I have a table with a jsonb column that is something like this:
I want to update
columnName.foo.bar
and not mutate anything else, how would I do this?
In SQL, would be something like:
Looked around on GitHub issues, Discord, and the docs and can't find a way to do this the Drizzle way.5 replies
DTDrizzle Team
•Created by PGT on 9/13/2023 in #help
any way to automatically cast numeric types on retrieval?
I have a numeric field in a video table:
but
duration
is a string so I end up casting it around my app
is there a better type to use or a way to cast on retreival? (i don't really need that much precision)5 replies
DTDrizzle Team
•Created by PGT on 9/2/2023 in #help
What's the correct type to use for an update function?
I'm trying to do a simple function where I update a record in a table:
When doing this:
I get the error:
Here's my schema
Because I'm using
NewVideo
, it TS expects a url
param, but because the record has already been created, this should already exist.
Should I use something like Partial<NewVideo>
?3 replies
DTDrizzle Team
•Created by PGT on 7/13/2023 in #help
NeonDbError: db error: ERROR: permission denied for schema drizzle
Created a new database on neon.tech today and trying to run migrations
Running migrations with:
Error:
3 replies
DTDrizzle Team
•Created by PGT on 5/31/2023 in #help
Running `drizzle-kit introspect:pg` returns "client password must be a string"
I'm attempting to move from objection.js+knex.js over to Drizzle and I'm running
drizzle-kit introspect:pg
against my database but I'm getting the error:
Here's my drizzle.config.ts
:
If i change connectionString: 'DATABASE_URL',
to connectionString: process.env.DATABASE_URL
, I get the error:
I've also tried to specify all the information in my connection string in the CLI params like drizzle-kit instropect:pg --host=... --user=... --password...
but get the same error.
Any help would be appreciated. Thanks in advance.6 replies