On Tuesday, my class was working on associations in Sequelize. We were getting lots of errors because when syncing tables with associations, the associated table must pre-exist the sync.
So, if Users has many Posts, to set up that association, the Posts model needs to exist, before trying to sync the Users table.
Today I learned, an interesting method for setting up Sequelize models and associations so you don’t get conflicts when syncing tables that depend on others to exist :
Essentially, this method breaks up the model creation and the association creation into separate consecutive steps. And does the sync later.
I'm still in class and still processing but had to share this game-changing (for me) information right away! Eeeep!