Cannot read properties of undefined (reading 'referencedTable')

i'm just playing around with queries and i can't get this to work:
const liked = await db.query.collectionsTable.findMany({
        with: {
            likedCollectionsTable: true
        }
    });
without the
with
it works.
i'm passing the schemas to the
db
object:
export const db = drizzle(queryClient, { schema });
and here are the two schemas:
export const likedCollectionsTable = pgTable('liked_collections', {
    userId: text('user_id').references(() => usersTable.id),
    collection_id: integer('collection_id').references(() => collectionsTable.id)
});

export const collectionsTable = pgTable('collections', {
    id: integer('id').primaryKey(),
    name: text('name'),
    type: collectionTypeEnum('type'),
    cover: text('cover'),
    artist: text('artist'),
    tags: text('tags')
        .references(() => tagsTable.name)
        .array(),
    releaseDate: date('release_date'),
    addedBy: text('added_by')
});
Was this page helpful?