如何使用 Nestjs 连接到 Planetscale
P粉311423594
P粉311423594 2023-08-28 20:10:23
0
1
483
<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粉311423594
P粉311423594

全部回复(1)
P粉418214279

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

synchronize: false
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板