Sequelize 不会将值插入到新添加的列中

Sequelize doesn't insert values into newly added columns

我有 Users table 并且我通过新迁移文件

添加了两个新列 emailfirstName 到 table
sequelize db:create --name add_columns_to_users

add_columns_to_users.js:

'use strict';
module.exports = {
  up: (queryInterface, Sequelize) => {

    return [
      queryInterface.addColumn(
        'Users',
        'email',
        {
          type: Sequelize.TEXT,
        }
      ),
      queryInterface.addColumn(
        'Users',
        'firstName',
        {
          type: Sequelize.TEXT,
        }
      )
    ];
  },

  down: (queryInterface, Sequelize) => {
  }
};

user/schema.graphql:

type User {
  id: ID!
  username: String
  email: String
  firstName: String
}

type Query {
  users(id: ID): [User]
}

input CreateUserInput {
  username: String!
  email: String!
  firstName: String!
}

type Mutation {
  createUser (input: CreateUserInput!): User
}

我的用户突变中有以下内容:

Mutation: {
    createUser(root, {input}, context){
    models.User.create(input).then( user => {
        console.log(user);
    });
  }
}

这是我要发送的输入:

{ 
  'username': profile.username,
  'email': profile.email,
  'firstName': profile.firstName
}

在我的日志中,我看到值没有被插入到新列 emailfirstName,而它对像“用户名”等旧列没有问题

INSERT INTO "Users" ("id","username","createdAt","updatedAt") VALUES 
(DEFAULT,'Sxxxxh RxxxF','2018-12-04 08:34:11.974 +00:00','2018-12-04 08:34:11.974 +00:00') 
RETURNING *;

我真傻!我忘了将新列添加到 models/user.js

models/user.js:

'use strict';

module.exports = (sequelize, DataTypes) => {
  const User = sequelize.define('User', {
    username: DataTypes.TEXT,
    password: DataTypes.TEXT,
    token: DataTypes.TEXT,
    abbr: DataTypes.TEXT,
    deleted: DataTypes.BOOLEAN,
    email: DataTypes.TEXT,
    firstName: DataTypes.TEXT
  }, {});

  User.associate = function(models) {
  };
  return User;
};