-
Notifications
You must be signed in to change notification settings - Fork 255
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
Migrate driver adapters to prisma/prisma #4380
Changes from 17 commits
9bc500f
86b585e
a93c6f7
4e6db6e
d3d9ad4
269d2dc
1490e5b
254f5b4
cba8e8f
03913ca
e0ea528
463775a
418c50d
67a89bd
6d070ed
5c2601a
96d4cd0
ca8b9e3
06cb9c8
0c2f426
d6614c1
187e46f
eeaaa8f
5541534
0c2ab39
2ef6ee3
a0b1f28
feb5244
489fe86
7eb2831
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ CONFIG_PATH = ./query-engine/connector-test-kit-rs/test-configs | |
CONFIG_FILE = .test_config | ||
SCHEMA_EXAMPLES_PATH = ./query-engine/example_schemas | ||
DEV_SCHEMA_FILE = dev_datamodel.prisma | ||
DRIVER_ADAPTERS_BRANCH ?= main | ||
|
||
LIBRARY_EXT := $(shell \ | ||
case "$$(uname -s)" in \ | ||
|
@@ -44,7 +45,13 @@ release: | |
################# | ||
|
||
test-qe: | ||
ifndef DRIVER_ADAPTER | ||
cargo test --package query-engine-tests | ||
else | ||
@echo "Executing query engine tests with $(DRIVER_ADAPTER) driver adapter"; \ | ||
# Add your actual command for the "test-driver-adapter" task here | ||
$(MAKE) test-driver-adapter-$(DRIVER_ADAPTER); | ||
endif | ||
|
||
test-qe-verbose: | ||
cargo test --package query-engine-tests -- --nocapture | ||
|
@@ -80,6 +87,10 @@ dev-sqlite: | |
dev-libsql-sqlite: build-qe-napi build-connector-kit-js | ||
cp $(CONFIG_PATH)/libsql-sqlite $(CONFIG_FILE) | ||
|
||
test-libsql-sqlite: dev-libsql-sqlite test-qe-st | ||
|
||
test-driver-adapter-libsql: test-libsql-sqlite | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. convention over configuration to run driver adapters tests easily. See |
||
|
||
start-postgres9: | ||
docker compose -f docker-compose.yml up --wait -d --remove-orphans postgres9 | ||
|
||
|
@@ -115,12 +126,20 @@ start-pg-postgres13: build-qe-napi build-connector-kit-js start-postgres13 | |
dev-pg-postgres13: start-pg-postgres13 | ||
cp $(CONFIG_PATH)/pg-postgres13 $(CONFIG_FILE) | ||
|
||
test-pg-postgres13: dev-pg-postgres13 test-qe-st | ||
|
||
test-driver-adapter-pg: test-pg-postgres13 | ||
|
||
start-neon-postgres13: build-qe-napi build-connector-kit-js | ||
docker compose -f docker-compose.yml up --wait -d --remove-orphans neon-postgres13 | ||
|
||
dev-neon-ws-postgres13: start-neon-postgres13 | ||
cp $(CONFIG_PATH)/neon-ws-postgres13 $(CONFIG_FILE) | ||
|
||
test-neon-ws-postgres13: dev-neon-ws-postgres13 test-qe-st | ||
|
||
test-driver-adapter-neon: test-neon-ws-postgres13 | ||
|
||
start-postgres14: | ||
docker compose -f docker-compose.yml up --wait -d --remove-orphans postgres14 | ||
|
||
|
@@ -255,15 +274,48 @@ start-planetscale-vitess8: build-qe-napi build-connector-kit-js | |
dev-planetscale-vitess8: start-planetscale-vitess8 | ||
cp $(CONFIG_PATH)/planetscale-vitess8 $(CONFIG_FILE) | ||
|
||
test-planetscale-vitess8: dev-planetscale-vitess8 test-qe-st | ||
|
||
test-driver-adapter-planetscale: test-planetscale-vitess8 | ||
|
||
###################### | ||
# Local dev commands # | ||
###################### | ||
|
||
build-qe-napi: | ||
cargo build --package query-engine-node-api | ||
|
||
build-connector-kit-js: | ||
cd query-engine/driver-adapters/js && pnpm i && pnpm build | ||
build-connector-kit-js: build-driver-adapters symlink-driver-adapters | ||
cd query-engine/driver-adapters/connector-test-kit-executor && pnpm i && pnpm build | ||
|
||
build-driver-adapters: ensure-prisma-present | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@echo "Building driver adapters..." | ||
@cd ../prisma && pnpm --filter "*adapter*" i && pnpm --filter "*adapter*" build | ||
@echo "Driver adapters build completed."; | ||
|
||
symlink-driver-adapters: ensure-prisma-present | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@echo "Creating symbolic links for driver adapters..." | ||
@for dir in $(wildcard $(realpath ../prisma)/packages/*adapter*); do \ | ||
if [ -d "$$dir" ]; then \ | ||
dir_name=$$(basename "$$dir"); \ | ||
ln -sfn "$$dir" "$(realpath .)/query-engine/driver-adapters/$$dir_name"; \ | ||
echo "Created symbolic link for $$dir_name"; \ | ||
fi; \ | ||
done; | ||
@ln -sfn "../prisma/tsconfig.build.adapter.json" "./tsconfig.build.adapter.json"; \ | ||
echo "Symbolic links creation completed."; | ||
|
||
ensure-prisma-present: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@if [ -d ../prisma ]; then \ | ||
cd "$(realpath ../prisma)" && git fetch origin main; \ | ||
LOCAL_CHANGES=$$(git diff --name-only HEAD origin/main -- 'packages/*adapter*'); \ | ||
if [ -n "$$LOCAL_CHANGES" ]; then \ | ||
echo "⚠️ ../prisma diverges from prisma/prisma main branch. Test results might diverge from those in CI ⚠️ "; \ | ||
fi \ | ||
else \ | ||
echo "git clone --depth=1 https://github.com/prisma/prisma.git --branch=$(DRIVER_ADAPTERS_BRANCH) ../prisma"; \ | ||
git clone --depth=1 https://github.com/prisma/prisma.git --branch=$(DRIVER_ADAPTERS_BRANCH) "../prisma" && echo "Prisma repository has been cloned to ../prisma"; \ | ||
fi; | ||
|
||
# Quick schema validation of whatever you have in the dev_datamodel.prisma file. | ||
validate: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
adapter-* | ||
driver-adapter-utils | ||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ignoring symlinks from prisma/prisma |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
pnpm-debug.log | ||
dist/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{ | ||
"engines": { | ||
"node": ">=16.13", | ||
"pnpm": ">=8.6.6 <9" | ||
}, | ||
"name": "connector-test-kit-executor", | ||
"version": "5.4.0", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"private": true, | ||
|
@@ -16,13 +20,19 @@ | |
"@libsql/client": "0.3.5", | ||
"@neondatabase/serverless": "^0.6.0", | ||
"@planetscale/database": "1.11.0", | ||
"@prisma/adapter-libsql": "workspace:*", | ||
"@prisma/adapter-neon": "workspace:*", | ||
"@prisma/adapter-pg": "workspace:*", | ||
"@prisma/adapter-planetscale": "workspace:*", | ||
"@prisma/driver-adapter-utils": "workspace:*", | ||
"@prisma/adapter-libsql": "../adapter-libsql", | ||
"@prisma/adapter-neon": "../adapter-neon", | ||
"@prisma/adapter-pg": "../adapter-pg", | ||
"@prisma/adapter-planetscale": "../adapter-planetscale", | ||
"@prisma/driver-adapter-utils": "../driver-adapter-utils", | ||
Comment on lines
+24
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depending on symlinked driver adapters |
||
"@types/pg": "^8.10.2", | ||
"pg": "^8.11.3", | ||
"undici": "^5.26.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.5.1", | ||
"tsup": "^7.2.0", | ||
"tsx": "^3.12.7", | ||
"typescript": "^5.1.6" | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows us to test the query engine code against a particular prisma/prisma branch in CI. So we are not depending on merge ordering of prisma/prisma changes.
Example:
foo
of prisma/prismaDRIVER_ADAPTERS_BRANCH=foo
.