Skip to content

Commit b1e5776

Browse files
author
Jose Ganora
committed
#WN-118# Removed stats connection to use the same database as the rest of the system
1 parent 83fe6d9 commit b1e5776

File tree

7 files changed

+3
-39
lines changed

7 files changed

+3
-39
lines changed

.env.bitbucket-pipelines

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ DB_DATABASE=redcross_local
1313
DB_USERNAME=preparecenter
1414
DB_PASSWORD=preparecenter
1515

16-
STATS_DB_HOST=0.0.0.0
17-
STATS_DB_PORT=3307
18-
STATS_DB_DATABASE=redcross_logs
19-
STATS_DB_USERNAME=preparecenter
20-
STATS_DB_PASSWORD=preparecenter
21-
2216
BROADCAST_DRIVER=log
2317
CACHE_DRIVER=file
2418
QUEUE_CONNECTION=sync

.env.example

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ DB_DATABASE=preparecenter
1313
DB_USERNAME=preparecenter
1414
DB_PASSWORD=preparecenter
1515

16-
STATS_DB_HOST=mysql_stats
17-
STATS_DB_PORT=3306
18-
STATS_DB_DATABASE=usage_logs
19-
STATS_DB_USERNAME=preparecenter
20-
STATS_DB_PASSWORD=preparecenter
21-
2216
BROADCAST_DRIVER=log
2317
CACHE_DRIVER=file
2418
QUEUE_CONNECTION=sync

app/Classes/Repositories/UsageLogRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getForEndpoint($endpoint, $fromDate = null, $toDate = null)
8686

8787
public function listByEndpoint($fromDate = null, $toDate = null)
8888
{
89-
$query = DB::connection('stats_mysql')->table('usage_logs')
89+
$query = DB::table('usage_logs')
9090
->select('endpoint', 'application_id', DB::raw('count(*) as hit_count'))
9191
->groupBy('application_id', 'endpoint')
9292
->orderBy('hit_count', 'desc');

config/database.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,6 @@
6363
]) : [],
6464
],
6565

66-
// This connection is used for the stats database
67-
'stats_mysql' => [
68-
'driver' => 'mysql',
69-
'url' => env('STATS_DATABASE_URL'),
70-
'host' => env('STATS_DB_HOST', '127.0.0.1'),
71-
'port' => env('STATS_DB_PORT', '3306'),
72-
'database' => env('STATS_DB_DATABASE', 'forge'),
73-
'username' => env('STATS_DB_USERNAME', 'forge'),
74-
'password' => env('STATS_DB_PASSWORD', ''),
75-
'unix_socket' => env('STATS_DB_SOCKET', ''),
76-
'charset' => 'utf8mb4',
77-
'collation' => 'utf8mb4_unicode_ci',
78-
'prefix' => '',
79-
'prefix_indexes' => true,
80-
'strict' => true,
81-
'engine' => null,
82-
'options' => extension_loaded('pdo_mysql') ? array_filter([
83-
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
84-
]) : [],
85-
],
8666

8767
'pgsql' => [
8868
'driver' => 'pgsql',

database/migrations/2023_01_23_155432_create_usage_logs_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class CreateUsageLogsTable extends Migration
1313
*/
1414
public function up()
1515
{
16-
Schema::connection('stats_mysql')->create('usage_logs', function (Blueprint $table) {
16+
Schema::create('usage_logs', function (Blueprint $table) {
1717
$table->increments('id');
1818
$table->bigInteger('application_id');
1919
$table->string('method');

database/seeds/UsageLogTableSeeder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function run()
2121
$file->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::READ_AHEAD | SplFileObject::DROP_NEW_LINE | SplFileObject::READ_CSV);
2222

2323
foreach ($file as $row) {
24-
DB::connection('stats_mysql')->table('usage_logs')->insert([
24+
DB::table('usage_logs')->insert([
2525
'id' => $row[0],
2626
'method' => $row[1],
2727
'application_id' => $row[2],

helm-chart/values.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ secrets:
5555
DB_DATABASE: DB_DATABASE
5656
DB_USERNAME: DB_USERNAME
5757
DB_PASSWORD: DB_PASSWORD
58-
STATS_DB_HOST: STATS_DB_HOST
59-
STATS_DB_DATABASE: STATS_DB_DATABASE
60-
STATS_DB_USERNAME: STATS_DB_USERNAME
61-
STATS_DB_PASSWORD: STATS_DB_PASSWORD
6258
APP_KEY: APP_KEY
6359

6460
# Ingress (if using)

0 commit comments

Comments
 (0)