How to connect to Planetscale using Nestjs
P粉311423594
P粉311423594 2023-08-28 20:10:23
0
1
395
<p>I used typeorm to create a Nest application that contains many tables in mysql. </p> <p>When I try to connect the database to planetscale, it shows the corresponding error: </p> <pre class="brush:php;toolbar:false;">[Nest] 9160 - 03/23/2023, 3:56:07AM **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>When I try to connect it to the <strong>planetscale</strong> online database, I have many tables consisting of many rows, it shows these errors. </p> <p>Please help me handle this database connection without any errors...</p>
P粉311423594
P粉311423594

reply all(1)
P粉418214279

According to the PlanetScale Github repository, there appears to be an update to fix this issue. In the meantime, I managed to solve the problem by adding the following code in the TypeOrmModule parameter of app.module as well as the configured DataSource.

synchronize: false
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!