简体   繁体   中英

feathersjs/nodejs sequelize

I am using feathers js and sequelize. I already have existing models like users.

Now my question is if I wanted to add a new column to user model/database for example user_firstname should I directly add that to the model.js? or I need to create migrations for that?

How does it affect locally and on stating or production? Thank you.

Sample models.user, snippet

module.exports = function (app) {
  const sequelizeClient = app.get('sequelizeClient');
  const users = sequelizeClient.define('users', {
    username: {
      type: DataTypes.STRING(320),
      allowNull: false,
      unique: true,
    },
    password: {
      type: DataTypes.STRING,
      allowNull: true,
    },

If you don't use sequelize.sync() then you should create a migration, modify a model, build the app, deploy the app, run migrations on a DB that is related to the deployed app to make sure that the app is corresponding to a DB (a structure and data).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM