如果我删除本地的 Facebook 和 Google 部分,则迁移运行良好。 序列化Node.js 。
'use strict'
var DataTypes = require('sequelize/lib/data-types')
module.exports = {
up: async(queryInterface, Sequelize) => {
queryInterface.createTable(
'users', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true
},
method: {
type: DataTypes.ENUM('local', 'google', 'facebook')
},
local: {
email: {
type: Sequelize.STRING,
allowNull: false
},
password: {
type: Sequelize.STRING
}
},
google: {
id: {
type: Sequelize.STRING
}
},
facebook: {
id: {
type: Sequelize.STRING
}
},
createdAt: {
type: Sequelize.DATE
},
updatedAt: {
type: Sequelize.DATE
}
}, {
engine: 'InnoDB', // default: 'InnoDB'
charset: 'latin1', // default: null
schema: 'public' // default: public, PostgreSQL only.
}
)
}
}
完全错误:
Loaded configuration file "config/config.json". Using environment "development". (node:6530) [SEQUELIZE0006] DeprecationWarning: This database engine version is not supported, please update your database server. More information https://github.com/sequelize/sequelize/blob/master/ENGINE.md (Use `node --trace-deprecation ...` to show where the warning was created) == 20200627033341-users: migrating ======= (node:6530) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toString' of undefined at MySQLQueryGenerator.attributeToSQL (/Users/chabgood/projects/ReactJS/Auth/api/node_modules/sequelize/lib/dialects/mysql/query-generator.js:364:44) at MySQLQueryGenerator.attributesToSQL (/Users/chabgood/projects/ReactJS/Auth/api/node_modules/sequelize/lib/dialects/mysql/query-generator.js:434:45) at MySQLQueryInterface.createTable (/Users/chabgood/projects/ReactJS/Auth/api/node_modules/sequelize/lib/dialects/abstract/query-interface.js:222:38) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:6530) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:6530) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.