I believe that connections are made during the request. Sequelize does not communicate with the database. If the connection drops and returns, and the request was issued during that time, the connection cannot be completed, the request will fail. I think that I would spend time solving the database reliability problem, and not other options that mean more code, but this is my opinion.
You should think of define () as a way to set up tables on db in the dev block when your application starts. Ideally, a determination should be made only once. You can call the definition as many times as you want, but I believe that the state of the table will be the "last definition of call winnings." depending on your configuration, define will also DROP / CREATE your table, so you want to make sure that you understand when and why it is determined that the call is called.
You must call synchronization to save your definitions or to make sure that they are present in the existing db. you definitely do not want to name it several times, and your link to the sequelize instance should be single.
Of course, you can do whatever you want in dev, but from the point of view of running sequelize in the production setup, you probably do not want the synchronization to perform ANY definition, but instead just verify that the expected model that exists in the definition, matches the existing pattern, and synchronization should only be called once, ever, and its result should be used as a singleton instance.
source share