Skip to content

Commit

Permalink
Merge branch 'main' into strangle-nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Fernández authored Feb 13, 2024
2 parents c1768d1 + 9878210 commit bd2d195
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/wasm-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: ./.github/workflows/include/rust-wasm-setup

Expand All @@ -42,6 +44,14 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract Branch Name
run: |
branch="$(git show -s --format=%s | grep -o "DRIVER_ADAPTERS_BRANCH=[^ ]*" | cut -f2 -d=)"
if [ -n "$branch" ]; then
echo "Using $branch branch of driver adapters"
echo "DRIVER_ADAPTERS_BRANCH=$branch" >> "$GITHUB_ENV"
fi
- name: Setup benchmark
run: make setup-pg-bench
Expand Down Expand Up @@ -119,6 +129,9 @@ jobs:

- name: Create or update report
uses: peter-evans/create-or-update-comment@v3
# Only run on our repository
# It avoids an expected failure on forks
if: github.repository == 'prisma/prisma-engines'
with:
comment-id: ${{ steps.findReportComment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/wasm-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ jobs:

- name: Create or update report
uses: peter-evans/create-or-update-comment@v3
# Only run on our repository
# It avoids an expected failure on forks
if: github.repository == 'prisma/prisma-engines'
with:
comment-id: ${{ steps.findReportComment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
Expand Down
6 changes: 1 addition & 5 deletions query-engine/driver-adapters/executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,15 @@
"sideEffects": false,
"license": "Apache-2.0",
"dependencies": {
"@libsql/client": "0.3.6",
"@neondatabase/serverless": "0.8.1",
"@planetscale/database": "1.16.0",
"query-engine-wasm-latest": "npm:@prisma/query-engine-wasm@latest",
"query-engine-wasm-baseline": "npm:@prisma/[email protected]",
"@prisma/adapter-libsql": "workspace:*",
"@prisma/adapter-neon": "workspace:*",
"@prisma/adapter-pg": "workspace:*",
"@prisma/adapter-planetscale": "workspace:*",
"@prisma/driver-adapter-utils": "workspace:*",
"@types/pg": "8.10.9",
"@prisma/bundled-js-drivers": "workspace:*",
"mitata": "^0.1.6",
"pg": "8.11.3",
"undici": "6.0.1",
"ws": "8.14.2"
},
Expand Down
4 changes: 2 additions & 2 deletions query-engine/driver-adapters/executor/src/bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { fileURLToPath } from "node:url";

import * as qe from "./qe";

import pgDriver from "pg";
import { pg } from "@prisma/bundled-js-drivers";
import * as prismaPg from "@prisma/adapter-pg";
import { bindAdapter, DriverAdapter } from "@prisma/driver-adapter-utils";

Expand Down Expand Up @@ -176,7 +176,7 @@ async function pgAdapter(url: string): Promise<DriverAdapter> {
if (schemaName != null) {
args.options = `--search_path="${schemaName}"`;
}
const pool = new pgDriver.Pool(args);
const pool = new pg.Pool(args);

return new prismaPg.PrismaPg(pool, {
schema: schemaName,
Expand Down
12 changes: 5 additions & 7 deletions query-engine/driver-adapters/executor/src/testd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ import * as readline from 'node:readline'
import * as jsonRpc from './jsonRpc'

// pg dependencies
import pgDriver from 'pg'
import * as prismaPg from '@prisma/adapter-pg'

// neon dependencies
import { Pool as NeonPool, neonConfig } from '@neondatabase/serverless'
import { fetch } from 'undici'
import { WebSocket } from 'ws'
import { pg, neon, planetScale, libSql } from '@prisma/bundled-js-drivers'
import * as prismaNeon from '@prisma/adapter-neon'

// libsql dependencies
import { createClient } from '@libsql/client'
import { PrismaLibSQL } from '@prisma/adapter-libsql'

// planetscale dependencies
import { Client as PlanetscaleClient } from '@planetscale/database'
import { PrismaPlanetScale } from '@prisma/adapter-planetscale'


Expand Down Expand Up @@ -256,14 +253,15 @@ function postgresSchemaName(url: string) {

async function pgAdapter(url: string): Promise<DriverAdapter> {
const schemaName = postgresSchemaName(url)
const pool = new pgDriver.Pool(postgres_options(url))
const pool = new pg.Pool(postgres_options(url))
return new prismaPg.PrismaPg(pool, {
schema: schemaName
})

}

async function neonWsAdapter(url: string): Promise<DriverAdapter> {
const { neonConfig, Pool: NeonPool } = neon
const proxyURL = JSON.parse(process.env.DRIVER_ADAPTER_CONFIG || '{}').proxy_url ?? ''
if (proxyURL == '') {
throw new Error("DRIVER_ADAPTER_CONFIG is not defined or empty, but its required for neon adapter.");
Expand All @@ -281,7 +279,7 @@ async function neonWsAdapter(url: string): Promise<DriverAdapter> {
}

async function libsqlAdapter(url: string): Promise<DriverAdapter> {
const libsql = createClient({ url, intMode: 'bigint' })
const libsql = libSql.createClient({ url, intMode: 'bigint' })
return new PrismaLibSQL(libsql)
}

Expand All @@ -291,7 +289,7 @@ async function planetscaleAdapter(url: string): Promise<DriverAdapter> {
throw new Error("DRIVER_ADAPTER_CONFIG is not defined or empty, but its required for planetscale adapter.");
}

const client = new PlanetscaleClient({
const client = new planetScale.Client({
// preserving path name so proxy url would look like real DB url
url: copyPathName(url, proxyUrl),
fetch,
Expand Down
1 change: 1 addition & 0 deletions query-engine/driver-adapters/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ packages:
- '../../../prisma/packages/adapter-planetscale'
- '../../../prisma/packages/driver-adapter-utils'
- '../../../prisma/packages/debug'
- '../../../prisma/packages/bundled-js-drivers'
- './executor'

0 comments on commit bd2d195

Please sign in to comment.