Skip to content

[BUG]: findManyAndCount fails when using relations filters #18

@icomad

Description

@icomad

I am using [email protected] and [email protected] and when I try to run a findManyAndCount query using relations filters I get this error TypeError: undefined is not an object (evaluating 'casing.getColumnCasing').

I am not really familiar with drizzle-orm source code but I saw that in your src/generated/internal.ts on line 51 you call the function relationsFilterToSQL like this:

relationsFilterToSQL(
    ctx.table,
    filter,
    ctx.tableConfig.relations,
    ctx.schema,
    ctx.tableNamesMap,
    ctx.dialect.casing
  )

but relationsFilterToSQL type is

export declare function relationsFilterToSQL(table: SchemaEntry, filter: AnyRelationsFilter | AnyTableFilter, tableRelations: RelationsRecord, tablesRelations: TablesRelationalConfig, casing: CasingCache, depth?: number): SQL | undefined;

If I comment out ctx.tableNamesMap the query runs without issues but I don't know if I'm breaking something else without noticing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions