Lucifer
Lucifer
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
Oh that was not really an issue. I wrote a work around. Just wanted to figure out why is that. But thank you!
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
i think so, 0.33.0
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
node_postgres. yeah its wired, its giving me an array but as an object. and the comments are a normal array. so its just the postPicture
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
export const picturePostsRelations = relations(postsPicture, ({ one }) => ({ post: one(posts, { fields: [postsPicture.postId], references: [posts.id], }), }));
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
that is the relevant code
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
relations export const postsRelations = relations(posts, ({ one, many }) => ({ postsPicture: many(postsPicture), comments: many(comment), likes: many(like), author: one(users, { fields: [posts.userId], references: [users.id], }), }));
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
schema import { createTable } from "../schema"; import { uuid, varchar } from "drizzle-orm/pg-core"; import { posts } from "./post"; export const postsPicture = createTable("postsPicture", { postId: uuid("postId") .references(() => posts.id, { onDelete: "cascade" }) .notNull(), url: varchar("url", { length: 256 }).notNull(), });
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
the problem is only with postPictures
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
the query
19 replies
DTDrizzle Team
Created by Lucifer on 9/18/2024 in #help
Getting an object instead of an array.
const postsDb = await db.query.posts.findMany({ limit: 2, orderBy: posts.createdAt, with: { comments: true, postsPicture: { columns: { postId: true, url: true, }, }, }, });
19 replies