basecamp / basecamp/marginalia

Allow to report the database reference

Open
#102 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Ruby
Stars
1.8k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

From the guides https://guides.rubyonrails.org/active_record_multiple_databases.html on multiple databases, we have the following `database.yml` file:
```
production:
primary:
database: my_primary_database
user: root
adapter: mysql
primary_replica:
database: my_primary_database
user: root_readonly
adapter: mysql
replica: true
animals:
database: my_animals_database
user: animals_root
adapter: mysql
migrations_paths: db/animals_migrate
animals_replica:
database: my_animals_database
user: animals_readonly
adapter: mysql
replica: true
```
I would like to signal which database the query is running. Given the replicas have the same database name, the `database` comment on marginalia won't work.
Is it possible to add the `animals` and `animals_replica` names to the comments?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Active Record multiple-databases guide and the database.yml example, then inspect how Marginalia currently derives its database comment for ActiveRecord SQL queries. Determine how the animals and animals_replica references are exposed to the query, and consider the work done when comments distinguish those references even when their database names match.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.