loopbackio / loopbackio/loopback-connector
Model-specific schema not respected by SQL building methods
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 35
- Forks
- 102
- Avg merge
- 14h 26m
- Merged PRs (30d)
- 13
Description
We are working with a legacy database that has our data divided among different schemas.
As per the documentation, I should be able to set the schema for an individual model.
https://docs.strongloop.com/display/public/LB/Model+definition+JSON+file#ModeldefinitionJSONfile-Datasource-specificoptions
However, SQLConnector does not specify any schema in the SQL statements that it builds, even though there is a schema method that properly determines which schema to use for a given model.
We should use this schema method to always specify the schema in generated SQL.
@raymondfeng @bajtos What are the chances of this being implemented and released as version 3? It doesn't look like a complicated change, so I could probably implement it myself and submit a PR, if that increases the chances.
Are there any problems you can see with making this change? I know this would break loopback-connector-db2 since it needlessly overrides the schema method with a schema string property in the constructor, which is why I believe it should be released in the next major version.
Thanks :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read lib/sql.js around the schema method referenced in the issue, then trace the SQLConnector methods that build statements. Check how loopback-connector-db2 overrides schema and determine the compatibility impact. Done means generated SQL consistently uses the model-specific schema without breaking the documented connector behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, sql
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100