搜索

首页  >  问答  >  正文

如何使用 Nestjs 连接到 Planetscale

<p>我使用 typeorm 创建了一个 Nest 应用程序,其中包含 mysql 中的许多表。</p> <p>当我尝试将数据库连接到planetscale时,它显示相应的错误:</p> <pre class="brush:php;toolbar:false;">[Nest] 9160 - 03/23/2023, 3:56:07 AM **ERROR [ExceptionHandler] can't push predicates on concatenate** QueryFailedError: **can't push predicates on concatenate** at Query.onResult (/workspaces/result-gen/src/driver/mysql/MysqlQueryRunner.ts:222:33) at Query.execute (/workspaces/result-gen/node_modules/mysql2/lib/commands/command.js:36:14) at PoolConnection.handlePacket (/workspaces/result-gen/node_modules/mysql2/lib/connection.js:488:32) at PacketParser.onPacket (/workspaces/result-gen/node_modules/mysql2/lib/connection.js:94:12) at PacketParser.executeStart (/workspaces/result-gen/node_modules/mysql2/lib/packet_parser.js:75:16) at TLSSocket.<anonymous> (/workspaces/result-gen/node_modules/mysql2/lib/connection.js:387:25) at TLSSocket.emit (node:events:512:28) at addChunk (node:internal/streams/readable:324:12) at readableAddChunk (node:internal/streams/readable:297:9) at TLSSocket.Readable.push (node:internal/streams/readable:234:10)</pre> <p>当我尝试将其连接到 <strong>planetscale</strong> 在线数据库时,我有许多表由许多行组成,它显示了这些错误。</p> <p>请帮助我处理此数据库连接,不要出现任何错误...</p>
P粉311423594P粉311423594457 天前449

全部回复(1)我来回复

  • P粉418214279

    P粉4182142792023-08-29 10:40:01

    根据 PlanetScale Github 存储库,似乎有修复此问题的方法更新。与此同时,我设法通过在 app.moduleTypeOrmModule 参数以及配置的 DataSource 中添加以下代码来解决这个问题。

    synchronize: false

    回复
    0
  • 取消回复