Create any model with an id number field.
Use MySQL connector.
Post once. Post twice. Second post does not get created in DB due to having the same id.
The Id field of the model is not set to auto-increment in MySQL.
Id field should be set in the db to auto-increment (at least for MySQL)
Is there any way to do that if yes how? What i'd like is the ability to alter my DB when using migrateSchemaor other pieces of LB4 code (auto migrate or auto update).
The MySQL command is rather easy, for example ALTER TABLE post CHANGE Id Id INT(11) NOT NULL AUTO_INCREMENT; However i'd like to keep every DB change in LB4 instead of having to create a separate connection for my db.
Can i add a service to do this for all my models that have an Id (every model should have an Id tho') ? Any tips on how? Pretty new to nodejs & LB4.
I hope i'm not breaking any rules by asking this here, but stackoverflow doesnt seem to be of any use and the documentation is still lacking in some parts (at least for not very experienced devs on node) .
Also...is there any good production ready example for authentication (JWT or other) that i could use? There's an example in the docs, but it says its not production ready and as i am still learning i'd like to use the best possible solution.
Thanks!
Is there any way to do that if yes how? What i'd like is the ability to alter my DB when using migrateSchema or other pieces of LB4 code (auto migrate or auto update).
Set generated to true for db to seed ids:
@property({
id: true,
generated: true,
description: 'The unique identifier for a product',
})
id: number;
Same as lb3: https://loopback.io/doc/en/lb3/Model-definition-JSON-file.html
Is there any way to do that if yes how? What i'd like is the ability to alter my DB when using migrateSchema or other pieces of LB4 code (auto migrate or auto update).
Set generated to true for db to seed ids:
@property({ id: true, generated: true, description: 'The unique identifier for a product', }) id: number;Same as lb3: https://loopback.io/doc/en/lb3/Model-definition-JSON-file.html
Awesome, that works. I haven't tried LB3 since i just started with Loopback and i wanted to start with the latest ES.
Any tips on the auth question ? Thanks!
EDIT: One more question if i may, i'm assuming older Loopback components are not compatible with LB4 right? Such as storage component for uploading images/files through the api.
Any tips on the auth question ? Thanks!
Not production ready yet. See #1035 I think it's tabled for development Q1 2019. #1839
Can see example of concept: https://github.com/strongloop/loopback-next/tree/master/packages/authentication
One more question if i may, i'm assuming older Loopback components are not compatible with LB4 right? Such as storage component for uploading images/files through the api.
I'm not sure, I've just come in for lb4. Maybe a project maintainer can answer that for you.
Any tips on the auth question ? Thanks!
Not production ready yet. See #1035 I think it's tabled for development Q1 2019. #1839
Damn google surely isnt indexing that, couldnt find that information even tho' i searched for it the entire day. I guess i'll just sit back and wait for a better implementation since the package is giving me headaches and is not quite i'm looking for.
Can see example of concept: https://github.com/strongloop/loopback-next/tree/master/packages/authenticationOne more question if i may, i'm assuming older Loopback components are not compatible with LB4 right? Such as storage component for uploading images/files through the api.
I'm not sure, I've just come in for lb4. Maybe a project maintainer can answer that for you.
I took a closer look at lb3 and it seems that lb4 has been rewritten from scratch (used to be JS, now its TS) so i dont think it works.
Thanks for the info! Appreciate it!
Is there any way to do that if yes how? What i'd like is the ability to alter my DB when using migrateSchema or other pieces of LB4 code (auto migrate or auto update).
Set generated to true for db to seed ids:
@property({ id: true, generated: true, description: 'The unique identifier for a product', }) id: number;Same as lb3: https://loopback.io/doc/en/lb3/Model-definition-JSON-file.html
This works!
Ensure you Drop your table if it is not auto-updating :D
Most helpful comment
Set generated to true for db to seed ids:
Same as lb3: https://loopback.io/doc/en/lb3/Model-definition-JSON-file.html