loopbackio / loopbackio/loopback-connector-mysql

Differentiating between database name & table_schema

Open
#606 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
126
Forks
181
Avg merge
4d 7h
Merged PRs (30d)
12

Description

Hi.

While discovering models, if no schema is provided (and the `all` flag is false), the connector fetches the tables/models that belong to the logged-in user at MySQL DB. [Link](https://github.com/loopbackio/loopback-connector-mysql/blob/master/lib/discovery.js#L78) to the line.

If we look at [MySQL docs](https://dev.mysql.com/doc/refman/8.4/en/glossary.html#glos_schema), the database name is supposed to be synonymous with `table_schema`. Hence, fetching all tables doesn't make sense if no schema is provided. It should take the DB name as a schema.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/discovery.js at the linked line and trace discovery when no schema is provided and the all flag is false. Verify how the MySQL database name is available and confirm the completed behavior uses it as table_schema instead of fetching tables without a schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mysql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.