Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何使用knex alertableBuilder更新列注释_Node.js_Postgresql_Knex.js - Fatal编程技术网

Node.js 如何使用knex alertableBuilder更新列注释

Node.js 如何使用knex alertableBuilder更新列注释,node.js,postgresql,knex.js,Node.js,Postgresql,Knex.js,迁移文件如下所示: import * as Knex from 'knex'; exports.up = async (knex: Knex): Promise<any> => { await knex.schema.raw(` COMMENT on "USER".user_invite_state is '0 - not sent invitation email, 1 - sent without acknowledged, 2 - sent with acknow

迁移文件如下所示:

import * as Knex from 'knex';
exports.up = async (knex: Knex): Promise<any> => {
  await knex.schema.raw(`
  COMMENT on "USER".user_invite_state is '0 - not sent invitation email, 1 - sent without acknowledged, 2 - sent with acknowledged, 3 - invite failed';
  `);
};
exports.down = async (knex: Knex): Promise<any> => {};
从“Knex”导入*作为Knex;
exports.up=async(knex:knex):Promise=>{
等待knex.schema.raw(`
对“用户”的评论。用户的邀请状态为“0-未发送邀请电子邮件,1-未确认发送,2-已确认发送,3-邀请失败”;
`);
};
exports.down=async(knex:knex):Promise=>{};
当我进行knex迁移时,我得到的错误如下: 迁移失败,错误为: 对“用户”的评论。用户的“邀请”状态为“0-未发送邀请电子邮件,1-未确认发送,2-已确认发送,3-邀请失败”; -“评论”处或附近出现语法错误 错误:“评论”处或附近出现语法错误


有人对此有什么想法吗?

您应该使用queryBuilder,它完全可以在不同的db语法之间架起桥梁

向上导出异步函数(knex:knex){
等待knex.schema.alterTable(tn,t=>{
t、 整数('colName')
.comment('这是我的评论')
.alter();
});
}

在pgAdmin上运行sql时,一切正常。