Cannot query DB table get `COALESCE types smallint and text cannot be matched`

When i run the following query

let tc = await db.query.ATable.findFirst({
    where: and(
        eq(ATable.year, year),
        eq(ATable.week, week),
        eq(ATable.ownerId, userId)
    ),
    with: {
        bs: true,
        cs: true
    }
})


I get the query error COALESCE types smallint and text cannot be matched.

Any thoughts on how I can get around this? Schema posted in the comments
Was this page helpful?