Sequelize 在生产版本中生成一些随机别名

问题描述 投票:0回答:1

以下查询在具有开发版本(next.js 应用程序)的本地环境上工作得很好,但在产品版本(使用 Vercel 部署)上执行时开始为 Payments 表生成一些随机别名。基本上,Sequelize 会使用

as "gs"
Payments
表生成查询。

const existingBooking = await BookingRequests.findByPk(id, {
   include: [
     { model: SectorBookings, include: [Payments] },
     { model: BookingComments, attributes: ["text"] },
   ],
 });

Payments
SectorBookings

之间存在多对多关联
SectorBookings.belongsToMany(Payments, {
  through: SectorBookingPayments,
  foreignKey: "sectorBookingId",
  otherKey: "paymentId",
});
Payments.belongsToMany(SectorBookings, {
  through: SectorBookingPayments,
  foreignKey: "paymentId",
  otherKey: "sectorBookingId",
});
postgresql sequelize.js vercel
1个回答
0
投票

我在使用 [email protected] 时遇到类似问题,但如果我使用 [email protected],问题就会消失。

我还没有确切地确定为什么会出现这种情况,但我的直觉是缩小器正在做一些奇怪的事情。

© www.soinside.com 2019 - 2024. All rights reserved.