我使用 graphql API 并尝试将数据插入 Postgress 表并收到错误:
"message": "column \"UserId\" does not exist",
Run Code Online (Sandbox Code Playgroud)
和我的原始查询:
Executing (default): INSERT INTO "Recipes"
("id","title","ingredients","direction","createdAt","updatedAt","userId") VALUES
(DEFAULT,$1,$2,$3,$4,$5,$6)
RETURNING
"id","title","ingredients","direction","createdAt","updatedAt","userId","UserId";
Run Code Online (Sandbox Code Playgroud)
问题是UserId列不在我的模型中,但userId是!我不知道为什么 Postgres 试图返回 UserId 列。我的模特。用户:
module.exports = (sequelize, DataTypes) => {
class User extends Model {
static associate(models) {
User.hasMany(models.Recipe)
}
};
User.init({
name: {
type: DataTypes.STRING,
allowNull: false
},
email: {
type: DataTypes.STRING,
allowNull: false
},
password: {
type: DataTypes.STRING,
allowNull: false
}
}, {
sequelize,
modelName: 'User',
});
return User;
}; …Run Code Online (Sandbox Code Playgroud) 将我的 Angular 版本升级到最新版本后,出现错误:
Content and Map of this Source is not available (only size() is supported)
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激,因为有关此问题的信息并不多。