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

feat: query compiler proof of concept #5024

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
43a8226
Prepare playground
aqrln Oct 24, 2024
ea65eca
Implement more structure
aqrln Oct 25, 2024
cf94c80
Inline the schema in the compiler example
aqrln Oct 25, 2024
acc196f
Remove useless explicit to_string
aqrln Oct 25, 2024
98f323a
Fix expression formatting
aqrln Oct 25, 2024
1771769
Split ReadQuery and WriteQuery
aqrln Oct 25, 2024
2e1bfe0
Implement translating simple read query
aqrln Oct 25, 2024
46294f7
Implement more queries
aqrln Oct 25, 2024
254d121
Implement placeholders
aqrln Oct 26, 2024
6033c0a
[integration]
aqrln Oct 26, 2024
a1957e3
[integration]
aqrln Oct 26, 2024
e8fba7a
Expand comment
aqrln Oct 26, 2024
4817326
Implement napi method
aqrln Oct 26, 2024
4576af8
[integration]
aqrln Oct 26, 2024
37dc418
Remove useless deref
aqrln Oct 26, 2024
91e59b8
[integration]
aqrln Oct 26, 2024
205ffb3
Improve placeholder serialization
aqrln Oct 26, 2024
2c5bbe8
[integration]
aqrln Oct 26, 2024
076993a
Fix warnings
aqrln Oct 26, 2024
c19388c
Add compile method on wasm
aqrln Oct 27, 2024
3ddb8b7
Make PrismaValue param parsing consistent with serialization
aqrln Oct 27, 2024
44eab95
[integration]
aqrln Oct 28, 2024
55af512
Switch dialect to sqlite
aqrln Oct 28, 2024
a902c3a
[integration]
aqrln Oct 28, 2024
573f2ea
[integration]
aqrln Oct 28, 2024
c99cd83
Comment out react native
aqrln Oct 28, 2024
d3e7a16
[integration]
aqrln Oct 28, 2024
e6c3e40
wip add param to dmmf
aqrln Oct 28, 2024
85e0210
Add comment
aqrln Oct 28, 2024
5d0bcba
[integration]
aqrln Oct 28, 2024
772ea5f
disable more react-native
aqrln Oct 28, 2024
a3fc692
check param in query schema in validation
aqrln Oct 28, 2024
ccc6570
switch to sqlite visitor
aqrln Oct 28, 2024
6096733
[integration]
aqrln Oct 28, 2024
3668ee0
add nested query in example
aqrln Dec 19, 2024
d32bfcf
Use lld via .cargo/config.toml and not env vars
aqrln Dec 23, 2024
f3c78f5
use postgres
aqrln Dec 23, 2024
6b19a39
remove dbg
aqrln Dec 23, 2024
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
8 changes: 8 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@ if command -v nix &> /dev/null && [ -z ${DISABLE_NIX+x} ]
then
use nix
fi

if [[ "$OSTYPE" == "linux-gnu"* ]] && command -v lld &> /dev/null && [ ! -f .cargo/config.toml ]; then
mkdir -p .cargo
cat << EOF > .cargo/config.toml
[target.$(uname -m)-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
EOF
fi
124 changes: 62 additions & 62 deletions .github/workflows/build-engines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ on:
push:
branches:
- main
- '*.*.x'
- 'integration/*'
- "*.*.x"
- "integration/*"
paths-ignore:
- '!.github/workflows/build-engines*'
- '.github/**'
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'
- "!.github/workflows/build-engines*"
- ".github/**"
- ".buildkite/**"
- "*.md"
- "LICENSE"
- "CODEOWNERS"
- "renovate.json"
workflow_dispatch:
pull_request:
paths-ignore:
- '!.github/workflows/build-engines*'
- '.github/**'
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'
- "!.github/workflows/build-engines*"
- ".github/**"
- ".buildkite/**"
- "*.md"
- "LICENSE"
- "CODEOWNERS"
- "renovate.json"

jobs:
is-release-necessary:
name: 'Decide if a release of the engines artifacts is necessary'
name: "Decide if a release of the engines artifacts is necessary"
runs-on: ubuntu-22.04
outputs:
release: ${{ steps.decision.outputs.release }}
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
END_OF_COMMIT_MESSAGE
echo "Commit message contains [integration]: ${{ contains(steps.commit-msg.outputs.commit-msg, '[integration]') }}"

- name: 'Check if commit message conatains `[integration]` and the PR author has permissions to trigger the workflow'
- name: "Check if commit message conatains `[integration]` and the PR author has permissions to trigger the workflow"
id: check-commit-message
# See https://docs.github.com/en/graphql/reference/enums
# https://michaelheap.com/github-actions-check-permission/
Expand All @@ -68,16 +68,16 @@ jobs:
# - the PR author has permissions to trigger the workflow (must be part of the org or a collaborator)
if: |
github.event_name == 'pull_request' &&
contains(steps.commit-msg.outputs.commit-msg, '[integration]') &&
contains(steps.commit-msg.outputs.commit-msg, '[integration]') &&
(
github.event.pull_request.author_association == 'OWNER' ||
github.event.pull_request.author_association == 'MEMBER' ||
github.event.pull_request.author_association == 'CONTRIBUTOR' ||
github.event.pull_request.author_association == 'COLLABORATOR'
)
run: |
echo "Commit message contains [integration] and PR author has permissions"
# set value to GitHub output
echo "Commit message contains [integration] and PR author has permissions"
# set value to GitHub output
echo "release=true" >> $GITHUB_OUTPUT

#
Expand Down Expand Up @@ -118,9 +118,9 @@ jobs:
# https://github.com/peter-evans/find-comment/tree/v3/?tab=readme-ov-file#outputs
# Tip: Empty strings evaluate to zero in GitHub Actions expressions. e.g. If comment-id is an empty string steps.fc.outputs.comment-id == 0 evaluates to true.
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'push' ||
steps.check-commit-message.outputs.release == 'true' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'push' ||
steps.check-commit-message.outputs.release == 'true' ||
steps.check-branch.outputs.release == 'true'

id: decision
Expand All @@ -140,7 +140,7 @@ jobs:

build-linux:
name: Build Engines for Linux
needs:
needs:
- is-release-necessary
if: ${{ needs.is-release-necessary.outputs.release == 'true' }}
uses: ./.github/workflows/build-engines-linux-template.yml
Expand All @@ -149,7 +149,7 @@ jobs:

build-macos-intel:
name: Build Engines for Apple Intel
needs:
needs:
- is-release-necessary
if: ${{ needs.is-release-necessary.outputs.release == 'true' }}
uses: ./.github/workflows/build-engines-apple-intel-template.yml
Expand All @@ -158,46 +158,46 @@ jobs:

build-macos-silicon:
name: Build Engines for Apple Silicon
needs:
needs:
- is-release-necessary
if: ${{ needs.is-release-necessary.outputs.release == 'true' }}
uses: ./.github/workflows/build-engines-apple-silicon-template.yml
with:
commit: ${{ github.sha }}

build-react-native:
name: Build Engines for React native
needs:
- is-release-necessary
if: ${{ needs.is-release-necessary.outputs.release == 'true' }}
uses: ./.github/workflows/build-engines-react-native-template.yml
with:
commit: ${{ github.sha }}
# build-react-native:
# name: Build Engines for React native
# needs:
# - is-release-necessary
# if: ${{ needs.is-release-necessary.outputs.release == 'true' }}
# uses: ./.github/workflows/build-engines-react-native-template.yml
# with:
# commit: ${{ github.sha }}

build-windows:
name: Build Engines for Windows
needs:
needs:
- is-release-necessary
if: ${{ needs.is-release-necessary.outputs.release == 'true' }}
uses: ./.github/workflows/build-engines-windows-template.yml
with:
commit: ${{ github.sha }}

release-artifacts:
name: 'Release artifacts from branch ${{ github.head_ref || github.ref_name }} for commit ${{ github.sha }}'
name: "Release artifacts from branch ${{ github.head_ref || github.ref_name }} for commit ${{ github.sha }}"
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.sha }}
needs:
- build-linux
- build-macos-intel
- build-macos-silicon
- build-react-native
# - build-react-native
- build-windows
env:
BUCKET_NAME: 'prisma-builds'
BUCKET_NAME: "prisma-builds"
PRISMA_ENGINES_COMMIT_SHA: ${{ github.sha }}
DESTINATION_TARGET_PATH: 's3://prisma-builds/all_commits/${{ github.sha }}'
DESTINATION_TARGET_PATH: "s3://prisma-builds/all_commits/${{ github.sha }}"

steps:
# Because we need the scripts
Expand All @@ -215,22 +215,22 @@ jobs:
# run-id: 9526334324
# github-token: ${{ secrets.GITHUB_TOKEN }}

- name: 'R2: Check if artifacts were already built and uploaded before via `.finished` file'
- name: "R2: Check if artifacts were already built and uploaded before via `.finished` file"
env:
FILE_PATH: 'all_commits/${{ github.sha }}/.finished'
FILE_PATH_LEGACY: 'all_commits/${{ github.sha }}/rhel-openssl-1.1.x/.finished'
AWS_DEFAULT_REGION: 'auto'
FILE_PATH: "all_commits/${{ github.sha }}/.finished"
FILE_PATH_LEGACY: "all_commits/${{ github.sha }}/rhel-openssl-1.1.x/.finished"
AWS_DEFAULT_REGION: "auto"
AWS_ACCESS_KEY_ID: ${{ vars.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ vars.R2_ENDPOINT }}
working-directory: .github/workflows/utils
run: bash checkFinishedMarker.sh

- name: 'S3: Check if artifacts were already built and uploaded before via `.finished` file'
- name: "S3: Check if artifacts were already built and uploaded before via `.finished` file"
env:
FILE_PATH: 'all_commits/${{ github.sha }}/.finished'
FILE_PATH_LEGACY: 'all_commits/${{ github.sha }}/rhel-openssl-1.1.x/.finished'
AWS_DEFAULT_REGION: 'eu-west-1'
FILE_PATH: "all_commits/${{ github.sha }}/.finished"
FILE_PATH_LEGACY: "all_commits/${{ github.sha }}/rhel-openssl-1.1.x/.finished"
AWS_DEFAULT_REGION: "eu-west-1"
AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
working-directory: .github/workflows/utils
Expand All @@ -247,14 +247,14 @@ jobs:
cp -r rhel-openssl-1.1.x debian-openssl-1.1.x
cp -r rhel-openssl-3.0.x debian-openssl-3.0.x

- name: Create .zip for react-native
working-directory: engines-artifacts
run: |
mkdir react-native
zip -r react-native/binaries.zip ios android
rm -rf ios android
# - name: Create .zip for react-native
# working-directory: engines-artifacts
# run: |
# mkdir react-native
# zip -r react-native/binaries.zip ios android
# rm -rf ios android

- name: 'Create compressed engine files (.gz)'
- name: "Create compressed engine files (.gz)"
working-directory: engines-artifacts
run: |
set -eu
Expand All @@ -266,13 +266,13 @@ jobs:

ls -Rl .

- name: 'Create SHA256 checksum files (.sha256).'
- name: "Create SHA256 checksum files (.sha256)."
working-directory: engines-artifacts
run: |
set -eu

find . -type f | while read filename; do
sha256sum "$filename" > "$filename.sha256"
sha256sum "$filename" > "$filename.sha256"
echo "$filename.sha256 file created."
done

Expand All @@ -292,7 +292,7 @@ jobs:
run: gpg -K

# next to each file (excluding .sha256 files)
- name: 'Create a GPG detached signature (.sig)'
- name: "Create a GPG detached signature (.sig)"
working-directory: engines-artifacts
run: |
set -eu
Expand All @@ -303,18 +303,18 @@ jobs:

ls -Rl .

- name: 'Cloudflare R2: Upload to bucket and verify uploaded files then create `.finished` file'
- name: "Cloudflare R2: Upload to bucket and verify uploaded files then create `.finished` file"
# https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-envvars.html
env:
AWS_DEFAULT_REGION: 'auto'
AWS_DEFAULT_REGION: "auto"
AWS_ACCESS_KEY_ID: ${{ vars.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ vars.R2_ENDPOINT }}
run: bash .github/workflows/utils/uploadAndVerify.sh engines-artifacts-for-r2

- name: 'AWS S3: Upload to bucket and verify uploaded files then create `.finished` file'
- name: "AWS S3: Upload to bucket and verify uploaded files then create `.finished` file"
env:
AWS_DEFAULT_REGION: 'eu-west-1'
AWS_DEFAULT_REGION: "eu-west-1"
AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: bash .github/workflows/utils/uploadAndVerify.sh engines-artifacts-for-s3
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test-compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ jobs:
- name: "Check that Cargo.lock did not change"
run: "git diff --exit-code"

test-react-native-compilation:
name: React Native
uses: ./.github/workflows/build-engines-react-native-template.yml
with:
commit: ${{ github.sha }}
uploadArtifacts: false
# test-react-native-compilation:
# name: React Native
# uses: ./.github/workflows/build-engines-react-native-template.yml
# with:
# commit: ${{ github.sha }}
# uploadArtifacts: false
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading