Use ForestAdmin to sync database

Hey guys, hope you’re doing great!

Is it possible to sync my database tables? By using sequelize await this.sequelize.sync({ force: dbReset, logging: true });

Thanks a lot!

Hello @caid,

Thanks for reaching out, we’re doing very well here :raised_hands: Hopefully you too!

To answer you properly, could you precise what do you want to achieve and why?

And as a side note, are you aware that there exists a lumber update command to update your models (see this documentation about it)?

Thanks.

Hey @anon34731316,

I’m good too! :slight_smile:
Thanks for your fast reply!
I want to use my forest api to create & sync a database with other tables, we can’t do that with lumber I guess :confused:

Best,

@caid I am sorry, your usecase is still a bit blurry to me.
I am not sure to understand why you need to create and sync another database :thinking:

But I guess your question is not really related to Forest Admin? It’s more about databases management and Sequelize model synchronization?

Hey @anon34731316 !

My message is both related to forestadmin & sequelize
I want to sync db model as described in the link you provided (thanks btw), but i can’t find where i should put the db sync method in the forest project

Hi @caid :wave: to achieve your goal, just put this in your /models/index.js file before exporting.
Unfortunately you can’t do that asynchronously, If you absolutely want to do it asynchronously, i suggest to do that in your middlewares/forestadmin.js before liana initialization.
Let me know if that help.

1 Like