cakephp / debug_kit

Debug Toolbar for CakePHP applications.
http://cakephp.org
Other
852 stars 573 forks source link

Read connections in SQL Log panel? #1003

Open ryanolton opened 5 months ago

ryanolton commented 5 months ago

I recently stumbled across this great feature that allows read-only connections, but I do not see any queries using the "read" connection in the SQL Log panel within DebugKit.

Does DebugKit support these "read" connections? Perhaps I'm missing some configuration setting?

The panel code seems to look for unique connections, in this cause it finds "default", but the "read" and "write" config keys specified seem to both be a part of "default", so they're not seen as two different connections. The end result is that the SQL Log panel only shows "write" connections, no "read" connections are visible.

'default' => [
    'className' => Connection::class,
    'driver' => Postgres::class,
    'encoding' => 'utf8',
    'host' => 'localhost',
    'username' => 'test',
    'password' => 'test',
    'database' => 'test_db',
    'read' => [
        'database' => 'read_test_db',
    ],
    'write' => [
        'database' => 'test_db',
    ],
    'log' => false,
],

Here is the original PR for this feature: https://github.com/cakephp/cakephp/pull/16785

markstory commented 5 months ago

DebugKit doesn't know about connection roles yet, we'd need to improve how debugkit collects queries to make that possible.