one-to-many

I might be asking something simple or have to change my model but I thought I'd ask cause I've been stuck for a while.

I have an images table
export const images = pgTable('images', {
  id: text('id')
    .$defaultFn(() => `image_${nanoid()}`)
    .primaryKey(),
  label: text('label'),
  url: text('url'),
  resourceId: text('resource_id'),
  resourceType: text('resource_type'),
  createdAt: timestamp('created_at').defaultNow().notNull(),
});

you can see I have a resourceId and a resourceType because I have different things that can have relations to images. I know I could create a table inbetween but I thought I'd try there, where I'm stuck is on setting up the relation. All the documentation shows
many(images)

But when I run it I get an error on the resource I'm doing the with as "There is not enough information to infer the relation"

Any suggestions?
Was this page helpful?