New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add boolean as a column value type in join #3121
Conversation
@@ -239,7 +239,7 @@ declare namespace Knex { | |||
(tableName: TableName | Identifier | QueryCallback, clause: JoinCallback): QueryBuilder; | |||
( | |||
tableName: TableName | Identifier | QueryCallback, | |||
columns: { [key: string]: string | number | Raw } | |||
columns: { [key: string]: string | number | boolean | Raw } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would it be a boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
The value of join can be boolean :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please provide example code that was invalid before this change?
The way I'm reading this binding is this:
knex('users')
.join('contacts', 'users.id', '=', 'contacts.user_id')
.select('users.id', 'contacts.phone')
columns
are these: 'users.id', '=', 'contacts.user_id'
Why would they ever be boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. And if typing is fixed, DB understands boolean value correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it works, it converts it into tinyInt automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually that depends highly on db that is used, but something like that :) I had big problems trying to write cross db compatible code that had used boolean column type.
Added missing type