Sequelize.js: how to use migrations and sync

后端 未结 11 1396
一向
一向 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:07

    Friend I had the same question and managed to understand how to use them.

    I started without ORM sequelize therefore I already had a data model.
    I had to generate the models automatically with sequelize-auto and generate their migrations with this file that you create https://gist.github.com/ahelord/a7a7d293695b71aadf04157f0f7dee64 and put in sync ({Force: false})
    This is in dev.I would have to version the model and the migrations and execute them every time I pull the code.

    In production the server is only upstairs so you only have to run migrations and in each commit manage as you will version the model without stopping the backend

提交回复
热议问题