DT
Drizzle TeamPaul
TypeError: Seems like the schema generic is missing - did you forget to add it to your DB type?
How can I solve the following generic error relating to the
db.query.users
in my code below?
I'm trying to create an adapter that accepts a generic schema to instantiate a PostgresJsDatabase
instance, or colloquially db
.
I've created the schema that is needed for this adapter, but how can I satisfy typescript when running db.query.user.findFirst()
?
A
Angelelz•225d ago
You are using the schema parameter passed to the
postgresAdapter
function. That parameter is typed as any.
Are you planning to use this function to pass it different schemas? What is the purpose of passing the schama as a parameter?P
Paul•224d ago
Yeah I was looking to allow users of this function to pass in their drizzle schema that should look a certain way for me to query. But I also created the same schema myself as a fallback.
On a high level, I'm trying to create an adapter to update a user's database. But I think defining the essential elements of the schema myself may suffice instead of allowing users to pass it in.
Anyways, I think it's okay to ignore this question if defining the generic of a schema is bit complicated. Thank you
A
Angelelz•224d ago
I'm not sure, but if in this line you delete the default type parameter it might work:
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.2KMembers
View on DiscordWant results from more Discord servers?
More PostsCan I create tables at runtime?Is it possible to create a user-specific schema and then generate tables within that schema when a uExecute is not exist on a type LibSQLDatabaseconst url = env.TURSO_DB_URL
if (url === undefined) {
throw new Error('TURSO_DB_URL is not defTransactions, PgBouncer/Supavisor, prepared statementsokay... i have spent way to long trying to figure out why when using transactions and a pooler on trhow enable wal for sqlite with drizzle ?how enable wal for sqlite with drizzle ?Simple ForeignKey With statement not workingHi - I am attempting to use a with statement on a query and am getting this error: Cannot read propMySQL UUID as PKI am unable to get a PK setup which has a default UUID value.
I have
```ts
logID: varchar('logID'totalCount from relational queryis it somehow possible to get the total count of a relational query?
Core queries aren't possible hCannot read properties of undefined (reading \'columns\')I tired using relational queries
` const bookmarkdb = drizzle(pool, { schema });
coDoes Drizzle support Microsoft SQL Server?Does Drizzle support Microsoft SQL Server ?Findfirst and Findmany configHello I am new to using drizzle and can't seem to make the findFirst and findMany work. I am using p