Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes loopbackio/loopback-next#2398
Duplicate of #404 because Jenkins fails randomly...
please review it with whitespace hided
loopbackio/loopback-next#2398 is partially fixed in loopbackio/loopback-datasource-juggler#1783.
Issue
The flag
useDefaultIdType: false
is supposed to allow to use custom type of auto-generated id property. But it only allows the default type, and it won't generated the custom id type itself as different DBs have different syntax/setup.For example, Postgres and MySQL default identity type is INT. And they can be auto-generated by
SERIAL
andAUTO_INCREAMENT
respectively.The model definition above won't work on Postgres and MySQL because these two connectors only support to auto-generated the default id type ( integer in this case).
From #3602 what suggests and real world usage, I am proposing to add
uuid
type to data type, and also add support for auto-generated string type id to Postgres connector:Proposal
uuid
and auto-generated, by default, useuuid-ossp
extension anduuid_generate_v4()
function to allow auto-generated string.when id type isstring
and auto-generated, treat it asuuid
. ( Should we?)However, it is user's responsibility to provide valid extension and function.
ALTER TABLE
to set up the table manually.If the above is okay, will fix MySQL as well.
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machine