Skip to content

.deleteFrom, .into and .joins don't support schema, only table names #32

@Brayden

Description

@Brayden

Describe the bug
When you use any of the following query builder operations in a chain they only take in a table name property, but no schema property. If a table is embedded in a schema there is no way for it to know where that table is located and how to fetch it.

  • deleteFrom(...)
  • innerJoin(...)
  • leftJoin(...)
  • rightJoin(...)
  • outerJoin(...)
  • into(...)

To Reproduce
See the current interface definition below. The selectFrom operator does allow for a schema, but other operations such as DELETE, INSERT, and UPDATE don't support that.

export interface OuterbaseType {
    queryBuilder: QueryBuilder
    selectFrom: (
        columnsArray: { schema?: string; table: string; columns: string[] }[]
    ) => OuterbaseType
    insert: (data: { [key: string]: any }) => OuterbaseType
    update: (data: { [key: string]: any }) => OuterbaseType
    deleteFrom: (table: string) => OuterbaseType
    where: (condition: any) => OuterbaseType
    limit: (limit: number) => OuterbaseType
    offset: (offset: number) => OuterbaseType
    orderBy: (column: string, direction?: 'ASC' | 'DESC') => OuterbaseType
    innerJoin: (
        table: string,
        condition: string,
        options?: any
    ) => OuterbaseType
    leftJoin: (table: string, condition: string, options?: any) => OuterbaseType
    rightJoin: (
        table: string,
        condition: string,
        options?: any
    ) => OuterbaseType
    outerJoin: (
        table: string,
        condition: string,
        options?: any
    ) => OuterbaseType
    into: (table: string) => OuterbaseType
    returning: (columns: string[]) => OuterbaseType
    asClass: (classType: any) => OuterbaseType
    query: () => Promise<any>
    queryRaw: (query: string, parameters?: QueryParams) => Promise<any>
    groupBy: (column: string) => OuterbaseType
    toString: () => string
}

Expected behavior
One may expect this to behave by passing both a schema and a table name into these and keeping them closely correlated when constructing queries.

Screenshots
N/A

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions