Skip to content

Commit

Permalink
Fix partial joins with prefixed tables
Browse files Browse the repository at this point in the history
  • Loading branch information
dankochetov committed May 3, 2023
1 parent 5045d4c commit 2841b63
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drizzle-orm",
"version": "0.25.4",
"version": "0.25.5",
"description": "Drizzle ORM package for SQL databases",
"type": "module",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion src/mysql-core/dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ export class MySqlDialect {
: table instanceof SQL
? undefined
: getTableName(table))
&& !((table) => joins.some(({ alias }) => alias === getTableName(table)))(f.field.table)
&& !((table) =>
joins.some(({ alias }) =>
alias === (table[Table.Symbol.IsAlias] ? getTableName(table) : table[Table.Symbol.BaseName])
))(f.field.table)
) {
const tableName = getTableName(f.field.table);
throw new Error(
Expand Down
5 changes: 4 additions & 1 deletion src/pg-core/dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ export class PgDialect {
: table instanceof SQL
? undefined
: getTableName(table))
&& !((table) => joins.some(({ alias }) => alias === getTableName(table)))(f.field.table)
&& !((table) =>
joins.some(({ alias }) =>
alias === (table[Table.Symbol.IsAlias] ? getTableName(table) : table[Table.Symbol.BaseName])
))(f.field.table)
) {
const tableName = getTableName(f.field.table);
throw new Error(
Expand Down
5 changes: 4 additions & 1 deletion src/sqlite-core/dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ export abstract class SQLiteDialect {
: table instanceof SQL
? undefined
: getTableName(table))
&& !((table) => joins.some(({ alias }) => alias === getTableName(table)))(f.field.table)
&& !((table) =>
joins.some(({ alias }) =>
alias === (table[Table.Symbol.IsAlias] ? getTableName(table) : table[Table.Symbol.BaseName])
))(f.field.table)
) {
const tableName = getTableName(f.field.table);
throw new Error(
Expand Down

0 comments on commit 2841b63

Please sign in to comment.