'Feathersjs with Sequelize, updating the model
I'm able to create a new service which creates a table in the MySQL DB just fine, but the feathersJS model file simply creates 1 text field in the model by default, when I modify the fields add more etc...this does not reflect in the database. Is there a migration script i must run ? can someone show me how to run a command that will reflect the changes i make to the model so I can sync the two. right now I have to manually modify the table to match the model.
Solution 1:[1]
In your src/sequelize.(js|ts), there should be a call like sequelize.sync(). This updates the structure of the database according to the model definitions every time the app gets started. So in theory, restarting the app should be enough.
If that doesn't work, try .sync({ alter: true }) or even .sync({ force: true }). (This might be fine during initial development, but is not recommended for production use as it can result in data loss. See also the docs about .sync() options.)
You already mentioned Migrations, which would be a better alternative for sure. With Umzug they can be automatically executed during startup as well.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | abrain |
