Sequelize.js: how to use migrations and sync

后端 未结 11 1438
一向
一向 2020-12-02 03:20

I\'m close to having my project ready to launch. I have big plans for after launch and the database structure is going to change -- new columns in existing tables as well as

11条回答
  •  情话喂你
    2020-12-02 04:08

    For development, there is now an option to sync the current tables by altering their structure. Using the latest version from the sequelize github repo, you can now run sync with the alter parameter.

    Table.sync({alter: true})
    

    A caveat from the docs:

    Alters tables to fit models. Not recommended for production use. Deletes data in columns that were removed or had their type changed in the model.

提交回复
热议问题