Skip to content

Commit 61e758f

Browse files
committed
Merge branch 'alternation-engine' of github.com:drizzle-team/drizzle-orm into alternation-engine
2 parents 34bef0b + f5cec4f commit 61e758f

File tree

313 files changed

+20726
-6008
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

313 files changed

+20726
-6008
lines changed

.github/workflows/release-feature-branch.yaml

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
name: Release (feature branch)
22

33
on:
4-
push:
5-
branches-ignore:
6-
- main
7-
pull_request: {}
4+
workflow_call:
5+
secrets:
6+
PLANETSCALE_CONNECTION_STRING:
7+
required: true
8+
NEON_CONNECTION_STRING:
9+
required: true
10+
NEON_HTTP_CONNECTION_STRING:
11+
required: true
12+
TIDB_CONNECTION_STRING:
13+
required: true
14+
XATA_API_KEY:
15+
required: true
16+
XATA_BRANCH:
17+
required: true
18+
LIBSQL_REMOTE_URL:
19+
required: true
20+
LIBSQL_REMOTE_TOKEN:
21+
required: true
22+
SQLITE_CLOUD_CONNECTION_STRING:
23+
required: true
24+
SQLITE_MANY_CLOUD_CONNECTION_STRING:
25+
required: true
826

927
concurrency:
1028
group: feature-${{ github.workflow }}-${{ github.ref }}
@@ -33,42 +51,6 @@ jobs:
3351
run: pnpm prisma generate --schema src/prisma/schema.prisma
3452
- name: Build all
3553
run: pnpm build:artifact
36-
37-
# has to be after build step, otherwise turbo cache miss
38-
- name: Apply version suffix to packages
39-
shell: bash
40-
run: |
41-
set -euxo pipefail
42-
suffix=$(git rev-parse --short HEAD)
43-
44-
packages=(
45-
"drizzle-orm"
46-
"drizzle-kit"
47-
"drizzle-zod"
48-
"drizzle-seed"
49-
"drizzle-typebox"
50-
"drizzle-valibot"
51-
"drizzle-arktype"
52-
"eslint-plugin-drizzle"
53-
)
54-
55-
for pkg in "${packages[@]}"; do
56-
pkg_dir="$pkg/dist"
57-
package_json="$pkg_dir/package.json"
58-
59-
if [[ ! -f "$package_json" ]]; then
60-
echo "WARN: $package_json not found, skipping"
61-
continue
62-
fi
63-
64-
base_version="$(jq -r '.version' "$package_json")"
65-
new_version="${base_version}-${suffix}"
66-
67-
echo "Setting $pkg dist version to $new_version"
68-
jq --arg v "$new_version" '.version = $v' "$package_json" > "$package_json.tmp"
69-
mv "$package_json.tmp" "$package_json"
70-
done
71-
# Upload compiled JS for tests to reuse
7254
- name: Upload build-dist
7355
uses: actions/upload-artifact@v4
7456
with:
@@ -231,9 +213,12 @@ jobs:
231213
LIBSQL_REMOTE_TOKEN: ${{ secrets.LIBSQL_REMOTE_TOKEN }}
232214
GEL_CONNECTION_STRING: gel://admin:password@localhost:56565/main
233215
SINGLESTORE_CONNECTION_STRING: singlestore://root:singlestore@localhost:33307/
216+
SINGLESTORE_MANY_CONNECTION_STRING: singlestore://root:singlestore@localhost:3308/;singlestore://root:singlestore@localhost:3309/;singlestore://root:singlestore@localhost:3310/;singlestore://root:singlestore@localhost:3311/
234217
COCKROACH_CONNECTION_STRING: postgresql://[email protected]:26257/defaultdb?sslmode=disable
235218
MSSQL_CONNECTION_STRING: mssql://SA:drizzle123PASSWORD!@localhost:1433?encrypt=true&trustServerCertificate=true
236219
TEST_CONFIG_PATH_PREFIX: ./tests/cli/
220+
SQLITE_CLOUD_CONNECTION_STRING: ${{ secrets.SQLITE_CLOUD_CONNECTION_STRING }}
221+
SQLITE_MANY_CLOUD_CONNECTION_STRING: ${{ secrets.SQLITE_MANY_CLOUD_CONNECTION_STRING }}
237222
working-directory: integration-tests
238223
shell: bash
239224
run: |
@@ -307,9 +292,6 @@ jobs:
307292
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
308293
runs-on: ubuntu-24.04
309294
timeout-minutes: 20
310-
strategy:
311-
matrix:
312-
package: [drizzle-kit, drizzle-zod, drizzle-seed, drizzle-typebox, drizzle-valibot, drizzle-arktype, eslint-plugin-drizzle]
313295
steps:
314296
- uses: actions/checkout@v4
315297
- uses: pnpm/action-setup@v4
@@ -324,8 +306,14 @@ jobs:
324306
name: packages
325307
path: ./artifacts
326308
- name: Run @arethetypeswrong/cli
327-
working-directory: ${{ matrix.package }}
328-
run: bun --bun run ../attw-fork/src/run.ts ../artifacts/${{ matrix.package }}/package.tgz
309+
run: |
310+
bun --bun run ./attw-fork/src/run.ts ./artifacts/drizzle-kit/package.tgz
311+
bun --bun run ./attw-fork/src/run.ts ./artifacts/drizzle-zod/package.tgz
312+
bun --bun run ./attw-fork/src/run.ts ./artifacts/drizzle-seed/package.tgz
313+
bun --bun run ./attw-fork/src/run.ts ./artifacts/drizzle-typebox/package.tgz
314+
bun --bun run ./attw-fork/src/run.ts ./artifacts/drizzle-valibot/package.tgz
315+
bun --bun run ./attw-fork/src/run.ts ./artifacts/drizzle-arktype/package.tgz
316+
bun --bun run ./attw-fork/src/run.ts ./artifacts/eslint-plugin-drizzle/package.tgz
329317
330318
attw-orm:
331319
needs: [prepare]
@@ -367,12 +355,13 @@ jobs:
367355
matrix:
368356
package: [drizzle-orm, drizzle-kit, drizzle-zod, drizzle-seed, drizzle-typebox, drizzle-valibot, drizzle-arktype, eslint-plugin-drizzle]
369357
steps:
370-
- uses: actions/checkout@v4
358+
- uses: actions/checkout@v5
371359

372360
# don't specify registry url, so there's no .npmrc config file
373-
- uses: actions/setup-node@v4
361+
- uses: actions/setup-node@v6
374362
with: { node-version: '24' }
375363

364+
# nuke, so npm can use OIDC
376365
- name: Remove temp npmrc
377366
run: rm -f "$NPM_CONFIG_USERCONFIG"
378367

@@ -389,9 +378,21 @@ jobs:
389378
shell: bash
390379
run: |
391380
set -euxo pipefail
392-
version="$(tar -xOf ./artifacts/${{ matrix.package }}/package.tgz package/package.json | jq -r .version)"
393-
tag="${{ github.ref_name }}"
394381
382+
_version="$(tar -xOf ./artifacts/${{ matrix.package }}/package.tgz package/package.json | jq -r .version)"
383+
tag="${{ github.ref_name }}"
384+
suffix=$(git rev-parse --short HEAD)
385+
version="$_version-$suffix"
386+
tmpdir="$(mktemp -d)"
387+
tar -xzf ./artifacts/${{ matrix.package }}/package.tgz -C "$tmpdir"
388+
389+
jq --arg v "$version" '.version = $v' \
390+
"$tmpdir/package/package.json" > "$tmpdir/package/package.json.tmp"
391+
mv "$tmpdir/package/package.json.tmp" "$tmpdir/package/package.json"
392+
393+
tar -czf ./artifacts/${{ matrix.package }}/package.tgz -C "$tmpdir" package
394+
rm -rf "$tmpdir"
395+
395396
is_published="$(npm view ${{ matrix.package }} versions --json | jq -r '.[] | select(. == "'$version'") | . == "'$version'"')"
396397
if [[ "$is_published" == "true" ]]; then
397398
echo "\`${{ matrix.package }}@$version\` already published, tagging \`$tag\`" >> $GITHUB_STEP_SUMMARY
@@ -403,5 +404,5 @@ jobs:
403404
shell: bash
404405
run: |
405406
set -euxo pipefail
406-
pnpm publish ./artifacts/${{ matrix.package }}/package.tgz --tag "${{ steps.checks.outputs.tag }}"
407-
echo "npm: \`${{ matrix.package }}@${{ steps.checks.outputs.tag }} | ${{ steps.checks.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
407+
npm publish ./artifacts/${{ matrix.package }}/package.tgz --tag "${{ steps.checks.outputs.tag }}"
408+
echo "npm: \`${{ matrix.package }}@${{ steps.checks.outputs.tag }} | ${{ steps.checks.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY

.github/workflows/release-latest.yaml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
name: Release (latest)
22

3-
on: workflow_dispatch
3+
on:
4+
workflow_call:
5+
secrets:
6+
PLANETSCALE_CONNECTION_STRING:
7+
required: true
8+
NEON_CONNECTION_STRING:
9+
required: true
10+
NEON_HTTP_CONNECTION_STRING:
11+
required: true
12+
TIDB_CONNECTION_STRING:
13+
required: true
14+
XATA_API_KEY:
15+
required: true
16+
XATA_BRANCH:
17+
required: true
18+
LIBSQL_REMOTE_URL:
19+
required: true
20+
LIBSQL_REMOTE_TOKEN:
21+
required: true
22+
SQLITE_CLOUD_CONNECTION_STRING:
23+
required: true
424

525
jobs:
626
test:
@@ -81,7 +101,7 @@ jobs:
81101
ports:
82102
- 33306:3306
83103
singlestore:
84-
image: ghcr.io/singlestore-labs/singlestoredb-dev:latest
104+
image: ghcr.io/singlestore-labs/singlestoredb-dev:0.2.67
85105
env:
86106
ROOT_PASSWORD: singlestore
87107
ports:
@@ -146,7 +166,7 @@ jobs:
146166
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
147167
# NEON_HTTP_CONNECTION_STRING: postgres://postgres:[email protected]:5432/postgres
148168
NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
149-
NEON_CONNECTION_STRING: postgres://postgres:postgres@localhost:5445/postgres
169+
# NEON_CONNECTION_STRING: postgres://postgres:postgres@localhost:5445/postgres
150170
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
151171
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
152172
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
@@ -157,6 +177,7 @@ jobs:
157177
COCKROACH_CONNECTION_STRING: postgresql://[email protected]:26257/defaultdb?sslmode=disable
158178
MSSQL_CONNECTION_STRING: mssql://SA:drizzle123PASSWORD!@localhost:1433?encrypt=true&trustServerCertificate=true
159179
TEST_CONFIG_PATH_PREFIX: ./tests/cli/
180+
SQLITE_CLOUD_CONNECTION_STRING: ${{ secrets.SQLITE_CLOUD_CONNECTION_STRING }}
160181
working-directory: integration-tests
161182
run: |
162183
case ${{ matrix.shard }} in
@@ -417,7 +438,9 @@ jobs:
417438
run: bun --bun run ../attw-fork/src/run.ts package.tgz ${{ matrix.shard }}
418439

419440
release:
420-
permissions: write-all
441+
permissions:
442+
contents: read
443+
id-token: write
421444
needs:
422445
- test
423446
- attw
@@ -436,12 +459,11 @@ jobs:
436459
- eslint-plugin-drizzle
437460
runs-on: ubuntu-22.04
438461
steps:
439-
- uses: actions/checkout@v4
462+
- uses: actions/checkout@v5
440463

441-
- uses: actions/setup-node@v4
442-
with:
443-
node-version: '22'
444-
registry-url: 'https://registry.npmjs.org'
464+
# don't specify registry url, so there's no .npmrc config file
465+
- uses: actions/setup-node@v6
466+
with: { node-version: '24' }
445467

446468
- uses: pnpm/action-setup@v3
447469
name: Install pnpm
@@ -478,7 +500,6 @@ jobs:
478500
479501
if [[ "$is_version_published" == "true" ]]; then
480502
echo "\`${{ matrix.package }}@$version\` already published, adding tag \`latest\`" >> $GITHUB_STEP_SUMMARY
481-
npm dist-tag add ${{ matrix.package }}@$version latest
482503
elif [[ "$latest" != "$version" ]]; then
483504
echo "Latest: $latest"
484505
echo "Current: $version"
@@ -512,16 +533,12 @@ jobs:
512533
if: steps.checks.outputs.has_new_release == 'true'
513534
working-directory: ${{ matrix.package }}
514535
shell: bash
515-
env:
516-
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
517536
run: npm run pack
518-
537+
519538
- name: Publish
520539
if: steps.checks.outputs.has_new_release == 'true'
521540
working-directory: ${{ matrix.package }}
522541
shell: bash
523-
env:
524-
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
525542
run: |
526543
version="${{ steps.checks.outputs.version }}"
527544

.github/workflows/router.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release Router
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
switch:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
target: ${{ steps.route.outputs.target }}
15+
steps:
16+
- name: Route release
17+
id: route
18+
run: |
19+
HEAD_REPO="${{ github.event.pull_request.head.repo.full_name }}"
20+
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" && "${GITHUB_REF##*/}" == "main" ]]; then
21+
echo "target=latest" >> $GITHUB_OUTPUT
22+
# only run on all pushes or pull requests from forks
23+
elif [[ "$GITHUB_EVENT_NAME" == "push" ]] || [[ "$HEAD_REPO" != "$GITHUB_REPOSITORY" ]]; then
24+
echo "target=feature" >> $GITHUB_OUTPUT
25+
else
26+
echo "target=skip" >> $GITHUB_OUTPUT
27+
fi
28+
29+
run-feature:
30+
needs: switch
31+
if: needs.switch.outputs.target == 'feature'
32+
uses: ./.github/workflows/release-feature-branch.yaml
33+
secrets:
34+
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
35+
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
36+
NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
37+
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
38+
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
39+
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
40+
LIBSQL_REMOTE_URL: ${{ secrets.LIBSQL_REMOTE_URL }}
41+
LIBSQL_REMOTE_TOKEN: ${{ secrets.LIBSQL_REMOTE_TOKEN }}
42+
SQLITE_CLOUD_CONNECTION_STRING: ${{ secrets.SQLITE_CLOUD_CONNECTION_STRING }}
43+
SQLITE_MANY_CLOUD_CONNECTION_STRING: ${{ secrets.SQLITE_MANY_CLOUD_CONNECTION_STRING }}
44+
45+
run-latest:
46+
needs: switch
47+
if: needs.switch.outputs.target == 'latest'
48+
uses: ./.github/workflows/release-latest.yaml
49+
secrets:
50+
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
51+
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
52+
NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
53+
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
54+
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
55+
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
56+
LIBSQL_REMOTE_URL: ${{ secrets.LIBSQL_REMOTE_URL }}
57+
LIBSQL_REMOTE_TOKEN: ${{ secrets.LIBSQL_REMOTE_TOKEN }}
58+
SQLITE_CLOUD_CONNECTION_STRING: ${{ secrets.SQLITE_CLOUD_CONNECTION_STRING }}

.oxlintrc.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,15 @@
6666
"typescript/no-empty-interface": "off",
6767
"typescript/no-unsafe-declaration-merging": "off",
6868
"no-inner-declarations": "off",
69-
"drizzle-internal/no-instanceof": "error",
7069
"drizzle-internal/require-entity-kind": "error"
7170
},
7271
"overrides": [
72+
{
73+
"files": ["drizzle-orm/**/*"],
74+
"rules": {
75+
"drizzle-internal/no-instanceof": "error"
76+
}
77+
},
7378
{
7479
"files": [
7580
"**/tests/**/*.ts",
@@ -78,7 +83,6 @@
7883
],
7984
"rules": {
8085
"import/extensions": "off",
81-
"drizzle-internal/no-instanceof": "off",
8286
"no-useless-escape": "off",
8387
"consistent-type-imports": "off",
8488
"no-unused-vars": "off",

changelogs/drizzle-kit/0.31.6.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Bug fixes
2+
3+
- [[BUG]: Importing drizzle-kit/api fails in ESM modules](https://github.com/drizzle-team/drizzle-orm/issues/2853)

changelogs/drizzle-kit/0.31.7.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Bug fixes
2+
3+
- [[BUG]: Drizzle Kit push to Postgres 18 produces unecessary DROP SQL when the schema was NOT changed](https://github.com/drizzle-team/drizzle-orm/issues/4944)

changelogs/drizzle-kit/0.31.8.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Bug fixes
2+
3+
- Fixed `algorythm` => `algorithm` typo

changelogs/drizzle-orm/0.45.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- Fixed pg-native Pool detection in node-postgres transactions
2+
- Allowed subqueries in select fields
3+
- Updated typo algorythm => algorithm
4+
- Fixed `$onUpdate` not handling `SQL` values (fixes [#2388](https://github.com/drizzle-team/drizzle-orm/issues/2388), tests implemented by [L-Mario564](https://github.com/L-Mario564) in [#2911](https://github.com/drizzle-team/drizzle-orm/pull/2911))
5+
- Fixed `pg` mappers not handling `Date` instances in `bun-sql:postgresql` driver responses for `date`, `timestamp` types (fixes [#4493](https://github.com/drizzle-team/drizzle-orm/issues/4493))

0 commit comments

Comments
 (0)