nehalist
nehalist
Explore posts from servers
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Types in Next.js Client components
it's actually interesting; my types.ts includes
export type Product = typeof products.$inferSelect;
export type Product = typeof products.$inferSelect;
and
export enum ProductModule {
Specifications = "specifications",
}
export enum ProductModule {
Specifications = "specifications",
}
if I only import Product (even without import type) , everything works fine. As soon as I want to get my enum, everything breaks 😦
6 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
thanks a lot
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
you mean the 2418 type thing?
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
unfortunately I'm facing a lot of weird issues with drizzle, like https://github.com/drizzle-team/drizzle-orm/issues/2418 or things like this. I get it that it's not 1.0 yet, but there's a voice in my head screaming "why not just use prisma again" pretty often 😦
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
thanks for your time
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
I will make a standalone repo because I can't open source the project I'm working on. will try to do so asap
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
maybe it's an issue with pg, but maybe drizzle lowercases the input somewhere (which would be very weird)
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
unfortunately I can't make out where in the code that happens, because - regarding the stack trace - it's in bin.cjs on line 81060
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
feels a lot like it
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
changed it to product_module - it works now. that's some weird issue
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
export const productModuleEnum = pgEnum("productModule", [
ProductModule.Specifications,
]);

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

modules: productModuleEnum("productModule")
.array()
.notNull()
.default(sql`ARRAY[]::productModule[]`),
there's nothing lowercased 😮
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
but why?
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
while the enum in the db (and the schema) are camelCase
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
what's very confusing is that the error productmodule is all lowercase
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
there's also a proper productModule enum in my database
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
hey there, thanks. what do you mean by "has to be part of your schema"? it'S within my schema.ts file
39 replies
DTDrizzle Team
Created by nehalist on 7/17/2024 in #help
Enum array column
trying to push this to my db
39 replies
TtRPC
Created by nehalist on 4/16/2023 in #❓-help
Type of createServerSideHelpers?
seems like somewhere in your code you're referencing prisma on the client
6 replies
TtRPC
Created by nehalist on 4/16/2023 in #❓-help
Type of createServerSideHelpers?
Figured it out myself:
export async function createServerSideProps(
ctx: GetServerSidePropsContext,
callback: (
helpers: DecoratedProcedureSSGRecord<AppRouter>
) => Record<string, any>
) {
const helpers = createServerSideHelpers({
router: appRouter,
ctx: {
user: await getServerSession(ctx.req, ctx.res, authOptions),
},
transformer: superjson,
});

const props = await callback(helpers);

return {
props: {
trpcState: helpers.dehydrate(),
...props,
},
};
}
export async function createServerSideProps(
ctx: GetServerSidePropsContext,
callback: (
helpers: DecoratedProcedureSSGRecord<AppRouter>
) => Record<string, any>
) {
const helpers = createServerSideHelpers({
router: appRouter,
ctx: {
user: await getServerSession(ctx.req, ctx.res, authOptions),
},
transformer: superjson,
});

const props = await callback(helpers);

return {
props: {
trpcState: helpers.dehydrate(),
...props,
},
};
}
6 replies