Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent results from raw SQL #11091

Merged
merged 4 commits into from
May 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
matthewp committed May 17, 2024
commit ba24884246805a8816ca3d5dd77a83d599a32cb8
3 changes: 3 additions & 0 deletions packages/db/src/runtime/db-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export function createRemoteDatabaseClient(appToken: string, remoteDbURL: string
}

if (method === 'run') {
const rawRows = Array.from(remoteResult.rows);
// in order to serialize properly much implement toJSON
matthewp marked this conversation as resolved.
Show resolved Hide resolved
(remoteResult as any).rows.toJSON = () => rawRows;
// Using `db.run()` drizzle massages the rows into an object.
// So in order to make dev/prod consistent, we need to do the same here.
// This creates an object and loops over each row replacing it with the object.
Expand Down
Loading