DB comments

This commit is contained in:
marcdeb1 2018-12-21 17:12:00 +01:00
parent 0d49e4d0c8
commit d61d9ff015
3 changed files with 5 additions and 5 deletions

View file

@ -218,7 +218,7 @@ return [
* See vendor\cakephp\cakephp\src\Database\Driver for complete list
*/
'Datasources' => [
'default' => [
'default' => [ // Chainquery database connection
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
@ -260,7 +260,7 @@ return [
'url' => env('DATABASE_URL', 'chainquery.lbry.io:3600'),
],
'localdb' => [
'localdb' => [ // Local db for price history
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,

View file

@ -579,9 +579,9 @@ class MainController extends AppController {
// get avg prices
$conn_local = ConnectionManager::get('localdb');
$stmt = $conn_local->execute("SELECT AVG(USD) AS AvgUSD, DATE_FORMAT(Created, '$sqlDateFormat') AS TimePeriod " .
$stmt_price = $conn_local->execute("SELECT AVG(USD) AS AvgUSD, DATE_FORMAT(Created, '$sqlDateFormat') AS TimePeriod " .
"FROM PriceHistory WHERE DATE_FORMAT(Created, '$sqlDateFormat') >= ? GROUP BY TimePeriod ORDER BY TimePeriod ASC", [$start->format($dateFormat)]);
$avgPrices = $stmt->fetchAll(\PDO::FETCH_OBJ);
$avgPrices = $stmt_price->fetchAll(\PDO::FETCH_OBJ);
foreach ($avgPrices as $price) {
if (!isset($resultSet[$price->TimePeriod])) {
$resultSet[$price->TimePeriod] = [];

View file

@ -5,7 +5,7 @@ namespace App\Model\Entity;
use Cake\ORM\Entity;
class PriceHistory extends Entity {
public $useDbConfig = 'localdb';
}
?>