-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Solving QueryBuilder problem when using postgresql #113
base: master
Are you sure you want to change the base?
Conversation
The problem occurs when a querybuilder is assembled for postgresql, since part of the code was dependent on Mysql, added some changes were made so that it accepts both MySQL and PostgreSQL.
src/api/TotalRecordsController.php
Outdated
@@ -134,7 +134,15 @@ public function handle(NovaRequest $request) | |||
$query = $model::selectRaw('HOUR('.$xAxisColumn.') AS cat, HOUR('.$xAxisColumn.') AS catorder, sum('.$calculation.') counted'.$seriesSql) | |||
->join($joinInformation['joinTable'], $joinInformation['joinColumnFirst'], $joinInformation['joinEqual'], $joinInformation['joinColumnSecond']); | |||
} else { | |||
$query = $model::selectRaw('HOUR('.$xAxisColumn.') AS cat, HOUR('.$xAxisColumn.') AS catorder, sum('.$calculation.') counted'.$seriesSql); | |||
if($connectionName == 'pgsql'){ | |||
//$query = $model::selectRaw('HOUR('.$xAxisColumn.') AS cat, HOUR('.$xAxisColumn.') AS catorder, sum('.$calculation.') counted'.$seriesSql); |
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.
Can you remove this comment @superior27 ? Thankyou
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.
Hi, sorry for have made you wait.
I removed this comment.
Remove comment in line 137
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.
Remove commits in code.
src/api/TotalRecordsController.php
Outdated
@@ -134,7 +134,15 @@ public function handle(NovaRequest $request) | |||
$query = $model::selectRaw('HOUR('.$xAxisColumn.') AS cat, HOUR('.$xAxisColumn.') AS catorder, sum('.$calculation.') counted'.$seriesSql) | |||
->join($joinInformation['joinTable'], $joinInformation['joinColumnFirst'], $joinInformation['joinEqual'], $joinInformation['joinColumnSecond']); | |||
} else { | |||
$query = $model::selectRaw('HOUR('.$xAxisColumn.') AS cat, HOUR('.$xAxisColumn.') AS catorder, sum('.$calculation.') counted'.$seriesSql); | |||
if($connectionName == 'pgsql'){ | |||
//$query = $model::selectRaw('HOUR('.$xAxisColumn.') AS cat, HOUR('.$xAxisColumn.') AS catorder, sum('.$calculation.') counted'.$seriesSql); |
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.
Hi, sorry for have made you wait.
I removed this comment.
The problem occurs when a querybuilder is assembled for postgresql, since part of the code was dependent on Mysql, added some changes were made so that it accepts both MySQL and PostgreSQL.