nehalist
nehalist
Explore posts from servers
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Types in Next.js Client components
I've got a schema (schema.ts) which defines my tables, a file for type declarations (types.ts) with things like export type Product = typeof products.$inferSelect; How am I supposed to use these types in client components? Since the types.ts imports from schema.ts we're no longer in client-only land and I get errors like Cannot resolve module 'fs' and similar.
6 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
Hey there, anyone got an idea why doesn't this work:
typescript
// my column:
modules: productModuleEnum("productModule")
.array()
.notNull()
.default(sql`ARRAY[]::text[]`),

// my enum:
export const productModuleEnum = pgEnum("productModule", [
ProductModule.Specifications,
]);
typescript
// my column:
modules: productModuleEnum("productModule")
.array()
.notNull()
.default(sql`ARRAY[]::text[]`),

// my enum:
export const productModuleEnum = pgEnum("productModule", [
ProductModule.Specifications,
]);
the error:
PostgresError: type "productmodule[]" does not exist
but... why?
39 replies
DTDrizzle Team
Created by nehalist on 1/23/2024 in #help
Is there an easy way for "member of"?
I do have a user and group table, and would like to get all groups where a user is member of. I could easily do that with joins, but I do know that some db frameworks (like doctrine) offer a "member of" helper. Is there something alike (that I'm too dumb to find in the docs)?
3 replies