Skip to content

feat(schema-engine): use pk for implicit join tables on postgres #2389

feat(schema-engine): use pk for implicit join tables on postgres

feat(schema-engine): use pk for implicit join tables on postgres #2389

name: "SE: integration tests"
on:
push:
branches:
- main
pull_request:
paths-ignore:
- ".github/**"
- "!.github/workflows/test-schema-engine.yml"
- ".buildkite/**"
- "*.md"
- "LICENSE"
- "CODEOWNERS"
- "renovate.json"
# Specific
- "query-engine/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-mongodb-schema-connector:
name: "${{ matrix.database.name }}"
strategy:
fail-fast: false
matrix:
database:
- name: "mongodb42"
url: "mongodb://prisma:prisma@localhost:27016/?authSource=admin&retryWrites=true"
- name: "mongodb44"
url: "mongodb://prisma:prisma@localhost:27017/?authSource=admin&retryWrites=true"
- name: "mongodb5"
url: "mongodb://prisma:prisma@localhost:27018/?authSource=admin&retryWrites=true"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@nextest
- name: Login to Docker Hub
uses: docker/login-action@v3
continue-on-error: true
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Start ${{ matrix.database.name }}"
run: make start-${{ matrix.database.name }}-single
- run: cargo nextest run -p mongodb-schema-connector
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
test-linux:
name: "${{ matrix.database.name }}"
strategy:
fail-fast: false
matrix:
database:
- name: mssql_2017
url: "sqlserver://localhost:1434;database=master;user=SA;password=<YourStrong@Passw0rd>;trustServerCertificate=true;socket_timeout=60;isolationLevel=READ UNCOMMITTED"
ubuntu: "20.04"
- name: mssql_2019
url: "sqlserver://localhost:1433;database=master;user=SA;password=<YourStrong@Passw0rd>;trustServerCertificate=true;socket_timeout=60;isolationLevel=READ UNCOMMITTED"
- name: mssql_2022
url: "sqlserver://localhost:1435;database=master;user=SA;password=<YourStrong@Passw0rd>;trustServerCertificate=true;socket_timeout=60;isolationLevel=READ UNCOMMITTED"
- name: mysql_5_6
url: "mysql://root:prisma@localhost:3309"
- name: mysql_5_7
url: "mysql://root:prisma@localhost:3306"
- name: mysql_8
url: "mysql://root:prisma@localhost:3307"
- name: mysql_mariadb
url: "mysql://root:prisma@localhost:3308"
- name: postgres9
url: "postgresql://postgres:prisma@localhost:5431"
- name: postgres10
url: "postgresql://postgres:prisma@localhost:5432"
- name: postgres11
url: "postgresql://postgres:prisma@localhost:5433"
- name: postgres12
url: "postgresql://postgres:prisma@localhost:5434"
- name: postgres13
url: "postgresql://postgres:prisma@localhost:5435"
- name: postgres14
url: "postgresql://postgres:prisma@localhost:5437"
- name: postgres15
url: "postgresql://postgres:prisma@localhost:5438"
- name: postgres16
url: "postgresql://postgres:prisma@localhost:5439"
- name: cockroach_23_1
url: "postgresql://prisma@localhost:26260"
- name: cockroach_22_2
url: "postgresql://prisma@localhost:26259"
- name: cockroach_22_1_0
url: "postgresql://prisma@localhost:26257"
- name: sqlite
url: sqlite
- name: vitess_8_0
url: "mysql://root:prisma@localhost:33807/test"
shadow_database_url: "mysql://root:prisma@localhost:33808/shadow"
is_vitess: true
single_threaded: true
runs-on: "ubuntu-20.04"
# TODO: Replace with the following once `[email protected]` is released.
# runs-on: "ubuntu-${{ matrix.database.ubuntu || 'latest' }}"
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@nextest
- name: Login to Docker Hub
uses: docker/login-action@v3
continue-on-error: true
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
if: "${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Start ${{ matrix.database.name }}"
run: make start-${{ matrix.database.name }}
- run: cargo nextest run -p sql-introspection-tests
if: ${{ !matrix.database.single_threaded }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
- run: cargo nextest run -p sql-schema-describer
if: ${{ !matrix.database.single_threaded }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
- run: cargo nextest run -p sql-migration-tests
if: ${{ !matrix.database.single_threaded }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
- run: cargo nextest run -p schema-engine-cli
if: ${{ !matrix.database.single_threaded }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
#
# Vitess tests
#
- run: cargo nextest run -p sql-introspection-tests --test-threads=1
if: ${{ matrix.database.is_vitess }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
TEST_SHADOW_DATABASE_URL: ${{ matrix.database.shadow_database_url }}
- run: cargo nextest run -p sql-migration-tests --test-threads=1
if: ${{ matrix.database.is_vitess }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
TEST_SHADOW_DATABASE_URL: ${{ matrix.database.shadow_database_url }}
RUST_LOG: debug
- run: cargo nextest run -p schema-engine-cli --test-threads=1
if: ${{ matrix.database.is_vitess }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
TEST_SHADOW_DATABASE_URL: ${{ matrix.database.shadow_database_url }}
#
# Single threaded tests (excluding Vitess)
#
- run: cargo nextest run -p sql-schema-describer --test-threads=1
if: ${{ !matrix.database.is_vitess && matrix.database.single_threaded }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
- run: cargo nextest run -p sql-introspection-tests --test-threads=1
if: ${{ !matrix.database.is_vitess && matrix.database.single_threaded }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
- run: cargo nextest run -p sql-migration-tests --test-threads=1
if: ${{ !matrix.database.is_vitess && matrix.database.single_threaded }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
RUST_LOG: debug
- run: cargo nextest run -p schema-engine-cli --test-threads=1
if: ${{ !matrix.database.is_vitess && matrix.database.single_threaded }}
env:
CLICOLOR_FORCE: 1
TEST_DATABASE_URL: ${{ matrix.database.url }}
test-windows:
strategy:
fail-fast: false
matrix:
db:
- name: "mysql-lts"
url: "mysql://root@localhost:3306?connect_timeout=20&socket_timeout=60"
- name: "mariadb"
url: "mysql://root@localhost:3306?connect_timeout=20&socket_timeout=60"
rust:
- stable
os:
- windows-latest
runs-on: ${{ matrix.os }}
name: "${{ matrix.db.name }} on Windows"
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@nextest
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install ${{ matrix.db.name }}
run: |
iwr -useb 'https://raw.githubusercontent.com/scoopinstaller/install/master/install.ps1' -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
scoop install sudo
scoop install ${{ matrix.db.name }}
sudo mysqld --install
sudo sc start MySQL
- name: Run tests
run: cargo nextest run -p sql-migration-tests
env:
TEST_DATABASE_URL: ${{ matrix.db.url }}