sequlize'

54 阅读1分钟
         const newGroup = await models.CheckItemsGroup.create({ name: groupId }, { transaction });

       if(newGroup){

           await models.CheckItems.update({ name: name, groupId: newGroup.dataValues.id }, { where: { id } }, { transaction });
           ctx.status = 204;
           errMsg = null
           await transaction.commit();
        }else{
           errMsg = '创建分组失败!!!'
           throw new Error("创建分组失败!!!");
        }
        
        
        
        
        我这里创建CheckItemsGroup表的一条记录,然后拿到对应id,然后去更新CheckItems,会提示外键不存在,有大佬有解决方案吗