Skip to content

Commit

Permalink
Merge branch 'main' into feat/generate-an-example-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolg42 committed Apr 25, 2024
2 parents 91a2b35 + 849be09 commit 0301082
Show file tree
Hide file tree
Showing 1,404 changed files with 64,326 additions and 26,503 deletions.
27 changes: 14 additions & 13 deletions .db.env
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
# Note: The default database name for the main connection string of each database has to be `tests` (or `master` for SQL Server) as we we search and replace that value later in our test setup

# PostgreSQL
TEST_POSTGRES_BASE_URI="postgres://prisma:prisma@localhost:5432"
TEST_POSTGRES_URI="postgres://prisma:prisma@localhost:5432/tests"
# Note: the isolated instance is only needed for one test (client/src/__tests__/integration/errors/connection-limit-postgres/test.ts)
TEST_POSTGRES_ISOLATED_URI="postgres://prisma:prisma@localhost:5435/tests"
TEST_POSTGRES_URI_MIGRATE="postgres://prisma:prisma@localhost:5432/tests-migrate"
TEST_POSTGRES_SHADOWDB_URI_MIGRATE="postgres://prisma:prisma@localhost:5432/tests-migrate-shadowdb"
# Note: the isolated instance is only needed for one test (client/src/__tests__/integration/errors/connection-limit-postgres/test.ts)
TEST_POSTGRES_ISOLATED_URI="postgres://prisma:prisma@localhost:5435/tests"

# MySQL
TEST_MYSQL_BASE_URI="mysql://root:root@localhost:3306"
TEST_MYSQL_URI="mysql://root:root@localhost:3306/tests"
# Note: the isolated instance is only needed for one test (client/src/__tests__/integration/errors/connection-limit-mysql/test.ts)
TEST_MYSQL_ISOLATED_URI="mysql://root:root@localhost:3307/tests"
TEST_MYSQL_URI_MIGRATE="mysql://root:root@localhost:3306/tests-migrate"
TEST_MYSQL_SHADOWDB_URI_MIGRATE="mysql://root:root@localhost:3306/tests-migrate-shadowdb"
# Note: the isolated instance is only needed for one test (client/src/__tests__/integration/errors/connection-limit-mysql/test.ts)
TEST_MYSQL_ISOLATED_URI="mysql://root:root@localhost:3307/tests"

# MariaDB
TEST_MARIADB_BASE_URI="mysql://root:root@localhost:4306"
TEST_MARIADB_URI="mysql://prisma:prisma@localhost:4306/tests"
TEST_MARIADB_URI="mysql://root:root@localhost:4306/tests"

# SQL Server
TEST_MSSQL_URI="mssql://SA:Pr1sm4_Pr1sm4@localhost:1433/master" # for `mssql` lib used in some tests
TEST_MSSQL_JDBC_URI="sqlserver://localhost:1433;database=master;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;"
TEST_MSSQL_JDBC_URI_MIGRATE="sqlserver://localhost:1433;database=tests-migrate;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;"
TEST_MSSQL_SHADOWDB_JDBC_URI_MIGRATE="sqlserver://localhost:1433;database=tests-migrate-shadowdb;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;"
TEST_MSSQL_URI="mssql://SA:Pr1sm4_Pr1sm4@localhost:1433/master" # for `mssql` lib used in some tests

# MongoDB
TEST_MONGO_URI="mongodb://root:prisma@localhost:27018/tests?authSource=admin"
TEST_MONGO_URI_MIGRATE="mongodb://root:prisma@localhost:27017/tests-migrate?authSource=admin"
TEST_MONGO_URI_MIGRATE_EXISTING_DB="mongodb://root:prisma@localhost:27017/tests-migrate-existing-db?authSource=admin"
TEST_MONGO_URI="mongodb://localhost:27018/tests"
TEST_MONGO_URI_MIGRATE="mongodb://localhost:27017/tests-migrate"
TEST_MONGO_URI_MIGRATE_EXISTING_DB="mongodb://localhost:27017/tests-migrate-existing-db"

# CockroachDB
TEST_COCKROACH_URI="postgresql://prisma@localhost:26257/tests"
Expand All @@ -36,11 +35,13 @@ TEST_COCKROACH_SHADOWDB_URI_MIGRATE="postgresql://prisma@localhost:26257/tests-m

# Prisma Client - Functional test suite
TEST_FUNCTIONAL_POSTGRES_URI="postgres://prisma:prisma@localhost:5432/PRISMA_DB_NAME"
TEST_FUNCTIONAL_POSTGRES_16_URI="postgres://prisma:prisma@localhost:15432/PRISMA_DB_NAME"
TEST_FUNCTIONAL_MYSQL_URI="mysql://root:root@localhost:3306/PRISMA_DB_NAME"
TEST_FUNCTIONAL_VITESS_8_URI="mysql://root:root@localhost:33807/PRISMA_DB_NAME"
TEST_FUNCTIONAL_MSSQL_URI="sqlserver://localhost:1433;database=PRISMA_DB_NAME;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;"
TEST_FUNCTIONAL_MONGO_URI="mongodb://root:prisma@localhost:27018/PRISMA_DB_NAME?authSource=admin"
TEST_FUNCTIONAL_MONGO_URI="mongodb://localhost:27018/PRISMA_DB_NAME"
TEST_FUNCTIONAL_COCKROACH_URI="postgresql://prisma@localhost:26257/PRISMA_DB_NAME"
TEST_FUNCTIONAL_LIBSQL_FILE_URI="file:/tmp/PRISMA_DB_NAME.db"

# To hide "Update available 0.0.0 -> x.x.x"
PRISMA_HIDE_UPDATE_MESSAGE="true"
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# To install more global node packages
RUN su node -c "npm install -g pnpm@7 ts-node"
RUN su node -c "npm install -g pnpm@8.15.5 ts-node"
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
node_modules
packages/**/node_modules
packages/**/node_modules
.idea/
.vscode/

.git/
26 changes: 13 additions & 13 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
# Note: The default database name for the main connection string of each database has to be `tests` (or `master` for SQL Server) as we we search and replace that value later in our test setup

# PostgreSQL
export TEST_POSTGRES_BASE_URI="postgres://prisma:prisma@localhost:5432"
export TEST_POSTGRES_URI="postgres://prisma:prisma@localhost:5432/tests"
# Note: the isolated instance is only needed for one test (client/src/__tests__/integration/errors/connection-limit-postgres/test.ts)
export TEST_POSTGRES_ISOLATED_URI="postgres://prisma:prisma@localhost:5435/tests"
export TEST_POSTGRES_URI_MIGRATE="postgres://prisma:prisma@localhost:5432/tests-migrate"
export TEST_POSTGRES_SHADOWDB_URI_MIGRATE="postgres://prisma:prisma@localhost:5432/tests-migrate-shadowdb"
# Note: the isolated instance is only needed for one test (client/src/__tests__/integration/errors/connection-limit-postgres/test.ts)
export TEST_POSTGRES_ISOLATED_URI="postgres://prisma:prisma@localhost:5435/tests"

# MySQL
export TEST_MYSQL_BASE_URI="mysql://root:root@localhost:3306"
export TEST_MYSQL_URI="mysql://root:root@localhost:3306/tests"
# Note: the isolated instance is only needed for one test (client/src/__tests__/integration/errors/connection-limit-mysql/test.ts)
export TEST_MYSQL_ISOLATED_URI="mysql://root:root@localhost:3307/tests"
export TEST_MYSQL_URI_MIGRATE="mysql://root:root@localhost:3306/tests-migrate"
export TEST_MYSQL_SHADOWDB_URI_MIGRATE="mysql://root:root@localhost:3306/tests-migrate-shadowdb"
# Note: the isolated instance is only needed for one test (client/src/__tests__/integration/errors/connection-limit-mysql/test.ts)
export TEST_MYSQL_ISOLATED_URI="mysql://root:root@localhost:3307/tests"

# MariaDB
export TEST_MARIADB_BASE_URI="mysql://root:root@localhost:4306"
export TEST_MARIADB_URI="mysql://prisma:prisma@localhost:4306/tests"
export TEST_MARIADB_URI="mysql://root:root@localhost:4306/tests"

# SQL Server
export TEST_MSSQL_URI="mssql://SA:Pr1sm4_Pr1sm4@localhost:1433/master" # for `mssql` lib used in some tests
export TEST_MSSQL_JDBC_URI="sqlserver://localhost:1433;database=master;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;"
export TEST_MSSQL_JDBC_URI_MIGRATE="sqlserver://localhost:1433;database=tests-migrate;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;"
export TEST_MSSQL_SHADOWDB_JDBC_URI_MIGRATE="sqlserver://localhost:1433;database=tests-migrate-shadowdb;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;"
export TEST_MSSQL_URI="mssql://SA:Pr1sm4_Pr1sm4@localhost:1433/master" # for `mssql` lib used in some tests

# MongoDB
export TEST_MONGO_URI="mongodb://root:prisma@localhost:27018/tests?authSource=admin"
export TEST_MONGO_URI_MIGRATE="mongodb://root:prisma@localhost:27017/tests-migrate?authSource=admin"
export TEST_MONGO_URI_MIGRATE_EXISTING_DB="mongodb://root:prisma@localhost:27017/tests-migrate-existing-db?authSource=admin"
export TEST_MONGO_URI="mongodb://localhost:27018/tests"
export TEST_MONGO_URI_MIGRATE="mongodb://localhost:27017/tests-migrate"
export TEST_MONGO_URI_MIGRATE_EXISTING_DB="mongodb://localhost:27017/tests-migrate-existing-db"

# CockroachDB
export TEST_COCKROACH_URI="postgresql://prisma@localhost:26257/tests"
Expand All @@ -36,10 +35,11 @@ export TEST_COCKROACH_SHADOWDB_URI_MIGRATE="postgresql://prisma@localhost:26257/

# Prisma Client - Functional test suite
export TEST_FUNCTIONAL_POSTGRES_URI="postgres://prisma:prisma@localhost:5432/PRISMA_DB_NAME"
export TEST_FUNCTIONAL_POSTGRES_16_URI="postgres://prisma:prisma@localhost:15432/PRISMA_DB_NAME"
export TEST_FUNCTIONAL_MYSQL_URI="mysql://root:root@localhost:3306/PRISMA_DB_NAME"
export TEST_FUNCTIONAL_VITESS_8_URI="mysql://root:root@localhost:33807/PRISMA_DB_NAME"
export TEST_FUNCTIONAL_MSSQL_URI="sqlserver://localhost:1433;database=PRISMA_DB_NAME;user=SA;password=Pr1sm4_Pr1sm4;trustServerCertificate=true;"
export TEST_FUNCTIONAL_MONGO_URI="mongodb://root:prisma@localhost:27018/PRISMA_DB_NAME?authSource=admin"
export TEST_FUNCTIONAL_MONGO_URI="mongodb://localhost:27018/PRISMA_DB_NAME"
export TEST_FUNCTIONAL_COCKROACH_URI="postgresql://prisma@localhost:26257/PRISMA_DB_NAME"

# To hide "Update available 0.0.0 -> x.x.x"
Expand Down
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# common
.github/renovate.json
dist/
esm/
build/
Expand All @@ -21,4 +22,5 @@ packages/cli/prisma-client/
packages/cli/install/
packages/cli/preinstall/
packages/cli/**/tmp-*
reproductions/

sandbox/
23 changes: 20 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
const path = require('path')

const project = path.resolve(__dirname, 'tsconfig.json')

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'jest', 'simple-import-sort', 'import'],
plugins: ['@typescript-eslint', 'jest', 'simple-import-sort', 'import', 'local-rules'],
env: {
node: true,
es6: true,
},
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: ['./tsconfig.json'],
project,
},
overrides: [
{
files: ['*.ts'],
files: ['./packages/client/src/runtime/core/types/exported/*.ts'],
excludedFiles: ['index.ts'],
rules: {
'local-rules/all-types-are-exported': 'error',
'local-rules/imports-from-same-directory': 'error',
},
},
{
files: ['./packages/client/src/runtime/core/types/exported/index.ts'],
rules: {
'local-rules/valid-exported-types-index': 'error',
},
},
],
extends: [
Expand Down Expand Up @@ -63,6 +78,8 @@ module.exports = {
'jest/valid-title': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
// low hanging fruits:
// to unblock eslint dep update in https://github.com/prisma/prisma/pull/21935
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
// to unblock eslint dep update in https://github.com/prisma/prisma/pull/9692
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/ban-types': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# See https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

* @prisma/team-orm-ts
* @prisma/orm-ts
43 changes: 41 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ inputs:
description: 'Skip build (Default: false).'
required: false
default: 'false'
engine-hash:
description: 'Pick up custom built engine from cache'
required: false

runs:
using: composite
steps:
- uses: pnpm/action-setup@v2.4.0
- uses: pnpm/action-setup@v3.0.0
with:
version: ${{ inputs.pnpm-version }}

- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: 'pnpm'
Expand All @@ -39,6 +42,42 @@ runs:
if: inputs.skip-tsc == 'true' && inputs.skip-build != 'true'
shell: bash

- name: Download custom engines
id: custom-engine
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-engine-${{ inputs.engine-hash }}-${{ github.event.number }}
path: |
target/release/schema-engine
target/release/schema-engine.exe
target/release/query-engine
target/release/query-engine.exe
target/release/libquery_engine.so
target/release/libquery_engine.dylib
target/release/query_engine.dll
- name: Set environment variables for custom engine
if: steps.custom-engine.outputs.cache-hit == 'true'
run: |
RELEASE_DIR="$(pwd)/target/release"
if [ -f "$RELEASE_DIR/libquery_engine.so" ]; then
echo "PRISMA_QUERY_ENGINE_LIBRARY=$RELEASE_DIR/libquery_engine.so" >> $GITHUB_ENV
echo "PRISMA_QUERY_ENGINE_BINARY=$RELEASE_DIR/query-engine" >> $GITHUB_ENV
echo "PRISMA_SCHEMA_ENGINE_BINARY=$RELEASE_DIR/schema-engine" >> $GITHUB_ENV
elif [ -f "$RELEASE_DIR/query_engine.dll" ]; then
WIN_RELEASE_DIR=$(cygpath -w $RELEASE_DIR)
echo "PRISMA_QUERY_ENGINE_LIBRARY=$WIN_RELEASE_DIR\\\query_engine.dll" >> $GITHUB_ENV
echo "PRISMA_QUERY_ENGINE_BINARY=$WIN_RELEASE_DIR\\\query-engine.exe" >> $GITHUB_ENV
echo "PRISMA_SCHEMA_ENGINE_BINARY=$WIN_RELEASE_DIR\\\schema-engine.exe" >> $GITHUB_ENV
elif [ -f "$RELEASE_DIR/libquery_engine.dylib" ]; then
echo "PRISMA_QUERY_ENGINE_LIBRARY=$RELEASE_DIR/libquery_engine.dylib" >> $GITHUB_ENV
echo "PRISMA_QUERY_ENGINE_BINARY=$RELEASE_DIR/query-engine" >> $GITHUB_ENV
echo "PRISMA_SCHEMA_ENGINE_BINARY=$RELEASE_DIR/schema-engine" >> $GITHUB_ENV
else
echo "Something went wrong. Build cache for engines exists, but no binaries for current OS found"
ls -la "$RELEASE_DIR"
exit 1
fi
shell: bash
- run: pnpm run build
if: inputs.skip-tsc == 'false' && inputs.skip-build != 'true'
shell: bash
15 changes: 15 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Enable/Disable PR comments
comment: false

# https://docs.codecov.com/docs/commit-status
# Disable both statuses
coverage:
status:
project: off
patch: off
# Alternatively we can have them as "informational"
# status:
# project:
# default:
# informational: true
# patch:
# default:
# informational: true

# About `carryforward: true`
# https://docs.codecov.com/docs/carryforward-flags

Expand Down
Loading

0 comments on commit 0301082

Please sign in to comment.