Loopback-next: automigration of database models boot script ?

Created on 18 Oct 2019  路  4Comments  路  Source: strongloop/loopback-next

Suggestion

It would be really nice not to have to re-invent the wheel to have a simple automigrate on models.
A boot script? That would be aware of cluster context? That would work with multiple datasources?

Use Cases

In dev / prototyping process, it's handy to have an automigration of database models that one can rely on.
For novices like me, It's a total nightmare event juste to figure out how to list datasources, data models.. and all info you can find on internet leads you to just more problems and dirty horrible ways.
This was the case with lb3... and it's just getting worse. With lb3 it never got solved and I'm sure it has been a nightmare for many.

Acceptance criteria

TBD - will be filled by the team.

feature

All 4 comments

@cantoute, are you aware that we have a migration script? https://loopback.io/doc/en/lb4/Database-migrations.html#auto-update-the-database-explicitly.

If you want something to be run during the start of the application, there's a concept of observers in LoopBack 4. Please also see my blog https://medium.com/loopback/loopback-quick-tip-seeding-database-using-life-cycle-observer-8ddca55fea5c for an example on how to make use of the observer (mine is for another purpose though).

Hope it helps.

This is exactly what I was dreaming to have when working with lb3... and I had totally missed out it was 1st class supported on lb4...

Thanks very much !!!

BTW great articles you wrote, I'll read them with lots of attention!
Words of yours will be very helpful, avoiding me - and as I already see many others - lots of frustration.
Th.x. very much

Thanks! :)
I'll close this issue then.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

milindsingh picture milindsingh  路  3Comments

half-blood-programmer picture half-blood-programmer  路  3Comments

rexliu0715 picture rexliu0715  路  3Comments

mightytyphoon picture mightytyphoon  路  3Comments

dericgw picture dericgw  路  3Comments