chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:10:05 +08:00
commit d37d8d293b
1388 changed files with 484182 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
node_modules
dist
dist-dts
examples
**/*.js
**/*.mjs
**/*.cjs
**/playground
integration-tests/tests/prisma/*/client
integration-tests/tests/prisma/*/drizzle
drizzle-kit/*
+84
View File
@@ -0,0 +1,84 @@
root: true
extends:
- 'eslint:recommended'
- 'plugin:@typescript-eslint/recommended'
- 'plugin:unicorn/recommended'
parser: '@typescript-eslint/parser'
parserOptions:
project: './tsconfig.json'
plugins:
- import
- unused-imports
- no-instanceof
- drizzle-internal
overrides:
- files:
- '**/tests/**/*.ts'
- '**/type-tests/**/*.ts'
rules:
import/extensions: 'off'
no-instanceof: 'off'
- files: 'eslint-plugin-drizzle/**/*'
rules:
import/extensions: 'off'
rules:
'@typescript-eslint/consistent-type-imports':
- error
- disallowTypeAnnotations: false
fixStyle: separate-type-imports
'@typescript-eslint/no-import-type-side-effects': 'error'
import/no-cycle: error
import/no-self-import: error
import/no-empty-named-blocks: error
unused-imports/no-unused-imports: error
import/no-useless-path-segments: error
import/newline-after-import: error
import/no-duplicates: error
import/extensions:
- error
- always
- ignorePackages: true
'@typescript-eslint/no-explicit-any': 'off'
'@typescript-eslint/no-non-null-assertion': 'off'
'@typescript-eslint/no-namespace': 'off'
'@typescript-eslint/no-unused-vars':
- error
- argsIgnorePattern: '^_'
varsIgnorePattern: '^_'
'@typescript-eslint/ban-types':
- error
- extendDefaults: true
types:
'{}' : false
'@typescript-eslint/no-this-alias': 'off'
'@typescript-eslint/no-var-requires': 'off'
'unicorn/prefer-node-protocol': 'off'
'unicorn/prefer-top-level-await': 'off'
'unicorn/prevent-abbreviations': 'off'
'unicorn/prefer-switch': 'off'
'unicorn/catch-error-name': 'off'
'unicorn/no-null': 'off'
'unicorn/numeric-separators-style': 'off'
'unicorn/explicit-length-check': 'off'
'unicorn/filename-case': 'off'
'unicorn/prefer-module': 'off'
'unicorn/no-array-reduce': 'off'
'unicorn/no-nested-ternary': 'off'
'unicorn/no-useless-undefined':
- error
- checkArguments: false
'unicorn/no-this-assignment': 'off'
'unicorn/empty-brace-spaces': 'off'
'unicorn/no-thenable': 'off'
'unicorn/consistent-function-scoping': 'off'
'unicorn/prefer-type-error': 'off'
'unicorn/relative-url-style': 'off'
'eqeqeq': 'error'
'no-instanceof/no-instanceof': 'error'
'drizzle-internal/require-entity-kind': 'error'
'unicorn/prefer-string-replace-all': 'off'
'unicorn/no-process-exit': 'off'
'@typescript-eslint/ban-ts-comment': 'off'
'@typescript-eslint/no-empty-interface': 'off'
'@typescript-eslint/no-unsafe-declaration-merging': 'off'
'no-inner-declarations': 'off'
+13
View File
@@ -0,0 +1,13 @@
# These are supported funding model platforms
github: drizzle-team
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+61
View File
@@ -0,0 +1,61 @@
name: "Bug Report"
description: Report an issue or possible bug
title: "[BUG]:"
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thank you for taking the time to file a bug report! Please provide as much information as possible.
- type: checkboxes
id: verified
attributes:
label: Report hasn't been filed before.
options:
- label: I have verified that the bug I'm about to report hasn't been filed before.
required: true
- type: input
attributes:
label: What version of `drizzle-orm` are you using?
description: You can check the version by opening the `package.json` file in your project.
placeholder: 0.0.0
validations:
required: true
- type: input
attributes:
label: What version of `drizzle-kit` are you using?
description: You can check the version by opening the `package.json` file in your project.
placeholder: 0.0.0
validations:
required: true
- type: input
attributes:
label: Other packages
description: If this bug is related to one of the other first-party packages we maintain, please list them here alongside their version.
placeholder: drizzle-zod@0.0.0, drizzle-valibot@0.0.0
validations:
required: false
- type: textarea
attributes:
label: Describe the Bug
description: |
To fill this field, please answer the following:
- What is the undesired behavior?
- What are the steps to reproduce it?
- What is the desired result?
If the issue is more specific, consider answering the following questions if you think they may be relevant:
- What database engine are you using? Are you using a specific cloud provider? Which one?
- Do you think this bug pertains to a specific database driver? Which one?
- Are you working in a monorepo?
- If this is a bug related to types: What Typescript version are you using? What's the content of your tsconfig.json file?
- If you're using a runtime that isn't Node.js: Which one? What version? Have you verified that this isn't an issue with the runtime itself?
validations:
required: true
+5
View File
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Ask a question
url: https://discord.gg/JGrkEU4Scj
about: Ask questions and discuss with other community members in Discord
+20
View File
@@ -0,0 +1,20 @@
name: "Documentation Enhancement"
description: Suggest documentation improvements
title: "[DOCS]:"
labels: ["docs"]
body:
- type: checkboxes
id: verified
attributes:
label: Enhancement hasn't been filed before.
options:
- label: I have verified this enhancement I'm about to request hasn't been suggested before.
required: true
- type: textarea
attributes:
label: Describe the enhancement you want to request
description: What do you want to change or add to the documentation?
validations:
required: true
@@ -0,0 +1,20 @@
name: "Feature Request"
description: Suggest new feature
title: "[FEATURE]:"
labels: ["enhancement"]
body:
- type: checkboxes
id: verified
attributes:
label: Feature hasn't been suggested before.
options:
- label: I have verified this feature I'm about to request hasn't been suggested before.
required: true
- type: textarea
attributes:
label: Describe the enhancement you want to request
description: What do you want to change or add? What are the benefits of implementing this?
validations:
required: true
+65
View File
@@ -0,0 +1,65 @@
name: "CodeQL"
on:
push:
branches: [ 'main', 'beta' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ 'main' ]
schedule:
- cron: '44 16 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-22.04
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
@@ -0,0 +1,425 @@
name: Release (feature branch)
on:
workflow_call:
secrets:
PLANETSCALE_CONNECTION_STRING:
required: true
NEON_CONNECTION_STRING:
required: true
# NEON_HTTP_CONNECTION_STRING:
# required: true
NETLIFY_DB_URL:
required: true
TIDB_CONNECTION_STRING:
required: true
XATA_API_KEY:
required: true
XATA_BRANCH:
required: true
LIBSQL_REMOTE_URL:
required: true
LIBSQL_REMOTE_TOKEN:
required: true
jobs:
test:
# only run on all pushes or pull requests from forks
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
shard:
- gel
- planetscale
- singlestore-core
- singlestore-proxy
- singlestore-prefixed
- singlestore-custom
- neon-http
- neon-serverless
- netlify-db
- drizzle-orm
- drizzle-kit
- drizzle-zod
- drizzle-seed
- drizzle-typebox
- drizzle-valibot
- drizzle-arktype
- other
runs-on: ubuntu-22.04
services:
postgres-postgis:
image: postgis/postgis:16-3.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 54322:5432
postgres-vector:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 54321:5432
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 55433:5432
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: drizzle
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 33306:3306
singlestore:
image: ghcr.io/singlestore-labs/singlestoredb-dev:latest
env:
ROOT_PASSWORD: singlestore
ports:
- 33307:3306
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.19'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build Prisma client
working-directory: drizzle-orm
run: pnpm prisma generate --schema src/prisma/schema.prisma
- name: Build
run: pnpm build
- name: Run tests
env:
PG_CONNECTION_STRING: postgres://postgres:postgres@localhost:55433/drizzle
PG_VECTOR_CONNECTION_STRING: postgres://postgres:postgres@localhost:54321/drizzle
PG_POSTGIS_CONNECTION_STRING: postgres://postgres:postgres@localhost:54322/drizzle
MYSQL_CONNECTION_STRING: mysql://root:root@localhost:33306/drizzle
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
# NEON_HTTP_CONNECTION_STRING: postgres://postgres:postgres@db.localtest.me:5432/postgres
NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
NEON_SERVERLESS_CONNECTION_STRING: postgres://postgres:postgres@localhost:5445/postgres
NETLIFY_DB_URL: ${{ secrets.NETLIFY_DB_URL }}
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
LIBSQL_URL: file:local.db
LIBSQL_REMOTE_URL: ${{ secrets.LIBSQL_REMOTE_URL }}
LIBSQL_REMOTE_TOKEN: ${{ secrets.LIBSQL_REMOTE_TOKEN }}
SINGLESTORE_CONNECTION_STRING: singlestore://root:singlestore@localhost:33307/
working-directory: integration-tests
run: |
if [[ ${{ github.event_name }} != "push" && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
export SKIP_EXTERNAL_DB_TESTS=1
fi
case ${{ matrix.shard }} in
gel)
if [[ -z "$SKIP_EXTERNAL_DB_TESTS" ]]; then
pnpm vitest run tests/gel
fi
;;
planetscale)
if [[ -z "$SKIP_EXTERNAL_DB_TESTS" ]]; then
pnpm vitest run \
tests/mysql/mysql-planetscale.test.ts \
tests/relational/mysql.planetscale-v1.test.ts \
tests/relational/mysql.planetscale.test.ts
fi
;;
singlestore-core)
pnpm vitest run tests/singlestore/singlestore.test.ts
;;
singlestore-proxy)
pnpm vitest run tests/singlestore/singlestore-proxy.test.ts
;;
singlestore-prefixed)
pnpm vitest run tests/singlestore/singlestore-prefixed.test.ts
;;
singlestore-custom)
pnpm vitest run tests/singlestore/singlestore-custom.test.ts
;;
neon-http)
if [[ -z "$SKIP_EXTERNAL_DB_TESTS" ]]; then
pnpm vitest run tests/pg/neon-http.test.ts tests/pg/neon-http-batch.test.ts
fi
;;
neon-serverless)
docker compose -f docker-neon.yml up -d
pnpm vitest run --config=./vitest-ci.config.ts tests/pg/neon-serverless.test.ts
docker compose -f docker-neon.yml down
;;
netlify-db)
pnpm vitest run tests/pg/netlify-db.test.ts
;;
drizzle-orm|drizzle-kit|drizzle-zod|drizzle-seed|drizzle-typebox|drizzle-valibot|drizzle-arktype)
(cd .. && pnpm test --filter ${{ matrix.shard }})
;;
other)
pnpm vitest run \
--exclude tests/gel \
--exclude tests/mysql/mysql-planetscale.test.ts \
--exclude tests/relational/mysql.planetscale-v1.test.ts \
--exclude tests/relational/mysql.planetscale.test.ts \
--exclude tests/singlestore/singlestore.test.ts \
--exclude tests/singlestore/singlestore-proxy.test.ts \
--exclude tests/singlestore/singlestore-prefixed.test.ts \
--exclude tests/singlestore/singlestore-custom.test.ts \
--exclude tests/pg/neon-http.test.ts \
--exclude tests/pg/neon-http-batch.test.ts \
--exclude tests/pg/neon-serverless.test.ts \
--exclude tests/pg/netlify-db.test.ts
;;
esac
attw:
# only run on all pushes or pull requests from forks
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
package:
- drizzle-orm
- drizzle-kit
- drizzle-zod
- drizzle-seed
- drizzle-typebox
- drizzle-valibot
- drizzle-arktype
- eslint-plugin-drizzle
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Install Bun
uses: oven-sh/setup-bun@v2
- name: Check preconditions
id: checks
shell: bash
working-directory: ${{ matrix.package }}
run: |
old_version="$(jq -r .version package.json)"
version="$old_version-$(git rev-parse --short HEAD)"
npm version $version
tag="${{ github.ref_name }}"
is_version_published="$(npm view ${{ matrix.package }} versions --json | jq -r '.[] | select(. == "'$version'") | . == "'$version'"')"
if [[ "$is_version_published" == "true" ]]; then
echo "\`${{ matrix.package }}$version\` already published, adding tag \`$tag\`" >> $GITHUB_STEP_SUMMARY
npm dist-tag add ${{ matrix.package }}@$version $tag
else
{
echo "version=$version"
echo "tag=$tag"
echo "has_new_release=true"
} >> $GITHUB_OUTPUT
fi
- name: Build Prisma client
if: steps.checks.outputs.has_new_release == 'true'
working-directory: drizzle-orm
run: pnpm prisma generate --schema src/prisma/schema.prisma
- name: Build
if: steps.checks.outputs.has_new_release == 'true'
run: pnpm build
- name: Pack
if: steps.checks.outputs.has_new_release == 'true'
working-directory: ${{ matrix.package }}
run: npm run pack
- name: Run @arethetypeswrong/cli
if: steps.checks.outputs.has_new_release == 'true'
working-directory: ${{ matrix.package }}
run: bunx attw package.tgz
release:
# only run on all pushes or pull requests from forks
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
needs:
- test
- attw
strategy:
matrix:
package:
- drizzle-orm
- drizzle-kit
- drizzle-zod
- drizzle-seed
- drizzle-typebox
- drizzle-valibot
- drizzle-arktype
- eslint-plugin-drizzle
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write # for OIDC
# force empty so npm can use OIDC
env:
NODE_AUTH_TOKEN: ""
NPM_TOKEN: ""
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with: { run_install: false }
- uses: actions/setup-node@v6
with: { node-version: '24', cache: 'pnpm', cache-dependency-path: pnpm-lock.yaml }
- run: pnpm install --frozen-lockfile --prefer-offline
# >= 11.5.1 for trusted publishing
- name: Update NPM
run: npm install -g npm@11 # npm 12.0.0 ships without sigstore in its bundled tree and breaks `npm publish`
# nuke, so npm can use OIDC
- name: Remove temp npmrc
run: rm -f "$NPM_CONFIG_USERCONFIG"
- name: Check preconditions
id: checks
shell: bash
working-directory: ${{ matrix.package }}
run: |
old_version="$(jq -r .version package.json)"
version="$old_version-$(git rev-parse --short HEAD)"
npm version $version
tag="${{ github.ref_name }}"
is_version_published="$(npm view ${{ matrix.package }} versions --json | jq -r '.[] | select(. == "'$version'") | . == "'$version'"')"
if [[ "$is_version_published" == "true" ]]; then
echo "\`${{ matrix.package }}$version\` already published, adding tag \`$tag\`" >> $GITHUB_STEP_SUMMARY
else
{
echo "version=$version"
echo "tag=$tag"
echo "has_new_release=true"
} >> $GITHUB_OUTPUT
fi
- name: Build Prisma client
working-directory: drizzle-orm
run: pnpm prisma generate --schema src/prisma/schema.prisma
- name: Build
if: steps.checks.outputs.has_new_release == 'true'
run: pnpm build
- name: Pack
if: steps.checks.outputs.has_new_release == 'true'
working-directory: ${{ matrix.package }}
shell: bash
run: npm run pack
- name: Publish
if: github.event_name == 'push' && steps.checks.outputs.has_new_release == 'true'
working-directory: ${{ matrix.package }}
shell: bash
run: |
tag="${{ steps.checks.outputs.tag }}"
version="${{ steps.checks.outputs.version }}"
echo "Publishing ${{ matrix.package }}@$tag using version $version"
npm run publish -- --tag $tag
echo "npm: \`${{ matrix.package }}@$tag | ${{ matrix.package }}@$version\`" >> $GITHUB_STEP_SUMMARY
# Post release message to Discord
# curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`${{ matrix.package }}\` release! 🎉\", \"url\": \"https://www.npmjs.com/package/${{ matrix.package }}/v/$version\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Version\", \"value\": \"\`$version\`\"}, {\"name\": \"Tag\", \"value\": \"\`$tag\`\"}]}]}" ${{ secrets.DISCORD_DEV_RELEASE_WEBHOOK_URL }}
+530
View File
@@ -0,0 +1,530 @@
name: Release (latest)
on:
workflow_call:
secrets:
PLANETSCALE_CONNECTION_STRING:
required: true
NEON_CONNECTION_STRING:
required: true
# NEON_HTTP_CONNECTION_STRING:
# required: true
NETLIFY_DB_URL:
required: true
TIDB_CONNECTION_STRING:
required: true
XATA_API_KEY:
required: true
XATA_BRANCH:
required: true
LIBSQL_REMOTE_URL:
required: true
LIBSQL_REMOTE_TOKEN:
required: true
jobs:
test:
strategy:
matrix:
shard:
- gel
- planetscale
- singlestore-core
- singlestore-proxy
- singlestore-prefixed
- singlestore-custom
- neon-http
- neon-serverless
- netlify-db
- drizzle-orm
- drizzle-kit
- drizzle-zod
- drizzle-seed
- drizzle-typebox
- drizzle-valibot
- drizzle-arktype
- other
runs-on: ubuntu-22.04
services:
postgres-postgis:
image: postgis/postgis:16-3.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 54322:5432
postgres-vector:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 54321:5432
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 55433:5432
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: drizzle
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 33306:3306
singlestore:
image: ghcr.io/singlestore-labs/singlestoredb-dev:latest
env:
ROOT_PASSWORD: singlestore
ports:
- 33307:3306
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.19'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build Prisma client
working-directory: drizzle-orm
run: pnpm prisma generate --schema src/prisma/schema.prisma
- name: Build
run: pnpm build
- name: Run tests
env:
PG_CONNECTION_STRING: postgres://postgres:postgres@localhost:55433/drizzle
PG_VECTOR_CONNECTION_STRING: postgres://postgres:postgres@localhost:54321/drizzle
PG_POSTGIS_CONNECTION_STRING: postgres://postgres:postgres@localhost:54322/drizzle
MYSQL_CONNECTION_STRING: mysql://root:root@localhost:33306/drizzle
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
# NEON_HTTP_CONNECTION_STRING: postgres://postgres:postgres@db.localtest.me:5432/postgres
NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
NEON_SERVERLESS_CONNECTION_STRING: postgres://postgres:postgres@localhost:5445/postgres
NETLIFY_DB_URL: ${{ secrets.NETLIFY_DB_URL }}
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
LIBSQL_URL: file:local.db
LIBSQL_REMOTE_URL: ${{ secrets.LIBSQL_REMOTE_URL }}
LIBSQL_REMOTE_TOKEN: ${{ secrets.LIBSQL_REMOTE_TOKEN }}
SINGLESTORE_CONNECTION_STRING: singlestore://root:singlestore@localhost:33307/
working-directory: integration-tests
run: |
case ${{ matrix.shard }} in
gel)
pnpm vitest run tests/gel
;;
planetscale)
pnpm vitest run \
tests/mysql/mysql-planetscale.test.ts \
tests/relational/mysql.planetscale-v1.test.ts \
tests/relational/mysql.planetscale.test.ts
;;
singlestore-core)
pnpm vitest run tests/singlestore/singlestore.test.ts
;;
singlestore-proxy)
pnpm vitest run tests/singlestore/singlestore-proxy.test.ts
;;
singlestore-prefixed)
pnpm vitest run tests/singlestore/singlestore-prefixed.test.ts
;;
singlestore-custom)
pnpm vitest run tests/singlestore/singlestore-custom.test.ts
;;
neon-http)
pnpm vitest run tests/pg/neon-http.test.ts tests/pg/neon-http-batch.test.ts
;;
neon-serverless)
docker compose -f docker-neon.yml up -d
pnpm vitest run tests/pg/neon-serverless.test.ts
docker compose -f docker-neon.yml down
;;
netlify-db)
pnpm vitest run tests/pg/netlify-db.test.ts
;;
drizzle-orm|drizzle-kit|drizzle-zod|drizzle-seed|drizzle-typebox|drizzle-valibot|drizzle-arktype)
(cd .. && pnpm test --filter ${{ matrix.shard }})
;;
other)
pnpm vitest run \
--exclude tests/gel \
--exclude tests/mysql/mysql-planetscale.test.ts \
--exclude tests/relational/mysql.planetscale-v1.test.ts \
--exclude tests/relational/mysql.planetscale.test.ts \
--exclude tests/singlestore/singlestore.test.ts \
--exclude tests/singlestore/singlestore-proxy.test.ts \
--exclude tests/singlestore/singlestore-prefixed.test.ts \
--exclude tests/singlestore/singlestore-custom.test.ts \
--exclude tests/pg/neon-http.test.ts \
--exclude tests/pg/neon-http-batch.test.ts \
--exclude tests/pg/neon-serverless.test.ts \
--exclude tests/pg/netlify-db.test.ts
;;
esac
attw:
strategy:
matrix:
package:
- drizzle-orm
- drizzle-kit
- drizzle-zod
- drizzle-seed
- drizzle-typebox
- drizzle-valibot
- drizzle-arktype
- eslint-plugin-drizzle
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.18'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Install Bun
uses: oven-sh/setup-bun@v2
- name: Check preconditions
id: checks
shell: bash
working-directory: ${{ matrix.package }}
run: |
latest="$(npm view --json ${{ matrix.package }} dist-tags.latest | jq -r)"
version="$(jq -r .version package.json)"
is_version_published="$(npm view ${{ matrix.package }} versions --json | jq -r '.[] | select(. == "'$version'") | . == "'$version'"')"
if [[ "$is_version_published" == "false" && "$latest" != "$version" ]]; then
{
echo "version=$version"
echo "has_new_release=true"
echo "changelog_path=$changelogPath"
} >> $GITHUB_OUTPUT
fi
- name: Build Prisma client
if: steps.checks.outputs.has_new_release == 'true'
working-directory: drizzle-orm
run: pnpm prisma generate --schema src/prisma/schema.prisma
- name: Build
if: steps.checks.outputs.has_new_release == 'true'
run: pnpm build
- name: Pack
if: steps.checks.outputs.has_new_release == 'true'
working-directory: ${{ matrix.package }}
run: npm run pack
- name: Run @arethetypeswrong/cli
if: steps.checks.outputs.has_new_release == 'true'
working-directory: ${{ matrix.package }}
run: bunx attw package.tgz
release:
permissions:
contents: write # for creating GitHub releases
id-token: write # for OIDC
needs:
- test
- attw
strategy:
fail-fast: false
matrix:
package:
- drizzle-orm
- drizzle-kit
- drizzle-zod
- drizzle-seed
- drizzle-typebox
- drizzle-valibot
- drizzle-arktype
- eslint-plugin-drizzle
runs-on: ubuntu-22.04
# force empty so npm can use OIDC
env:
NODE_AUTH_TOKEN: ""
NPM_TOKEN: ""
services:
postgres-postgis:
image: postgis/postgis:16-3.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 54322:5432
postgres-vector:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 54321:5432
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: drizzle
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 55433:5432
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: drizzle
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 33306:3306
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with: { run_install: false }
- uses: actions/setup-node@v6
with: { node-version: '24', cache: 'pnpm', cache-dependency-path: pnpm-lock.yaml }
- run: pnpm install --frozen-lockfile --prefer-offline
# >= 11.5.1 for trusted publishing
- name: Update NPM
run: npm install -g npm@11 # npm 12.0.0 ships without sigstore in its bundled tree and breaks `npm publish`
# nuke, so npm can use OIDC
- name: Remove temp npmrc
run: rm -f "$NPM_CONFIG_USERCONFIG"
- name: Check preconditions
id: checks
shell: bash
working-directory: ${{ matrix.package }}
run: |
latest="$(npm view --json ${{ matrix.package }} dist-tags.latest | jq -r)"
version="$(jq -r .version package.json)"
is_version_published="$(npm view ${{ matrix.package }} versions --json | jq -r '.[] | select(. == "'$version'") | . == "'$version'"')"
if [[ "$is_version_published" == "true" ]]; then
echo "\`${{ matrix.package }}@$version\` already published, adding tag \`latest\`" >> $GITHUB_STEP_SUMMARY
elif [[ "$latest" != "$version" ]]; then
echo "Latest: $latest"
echo "Current: $version"
changelogPath=$(node -e "console.log(require('path').resolve('..', 'changelogs', '${{ matrix.package }}', '$version.md'))")
if [[ ! -f "$changelogPath" ]]; then
echo "::error::Changelog for version $version not found: $changelogPath"
exit 1
fi
{
echo "version=$version"
echo "has_new_release=true"
echo "changelog_path=$changelogPath"
} >> $GITHUB_OUTPUT
else
echo "Already up to date: $version"
echo "\`$version\` is already latest on NPM" >> $GITHUB_STEP_SUMMARY
fi
- name: Build Prisma client
if: steps.checks.outputs.has_new_release == 'true'
working-directory: drizzle-orm
run: pnpm prisma generate --schema src/prisma/schema.prisma
- name: Build
if: steps.checks.outputs.has_new_release == 'true'
run: pnpm build
- name: Pack
if: steps.checks.outputs.has_new_release == 'true'
working-directory: ${{ matrix.package }}
shell: bash
run: npm run pack
- name: Publish
if: steps.checks.outputs.has_new_release == 'true'
working-directory: ${{ matrix.package }}
shell: bash
run: |
version="${{ steps.checks.outputs.version }}"
echo "Publishing ${{ matrix.package }}@$version"
npm run publish
echo "npm: \`+ ${{ matrix.package }}@$version\`" >> $GITHUB_STEP_SUMMARY
# Post release message to Discord
# curl -X POST -H "Content-Type: application/json" -d "{\"embeds\": [{\"title\": \"New \`${{ matrix.package }}\` release! 🎉\", \"url\": \"https://www.npmjs.com/package/${{ matrix.package }}\", \"color\": \"12907856\", \"fields\": [{\"name\": \"Tag\", \"value\": \"\`$tag\`\"}]}]}" ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
- name: Create GitHub release for ORM package
uses: actions/github-script@v6
if: matrix.package == 'drizzle-orm' && steps.checks.outputs.has_new_release == 'true'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
const fs = require("fs");
const path = require("path");
const version = "${{ steps.checks.outputs.version }}";
const changelog = fs.readFileSync("${{ steps.checks.outputs.changelog_path }}", "utf8");
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `${version}`,
name: `${version}`,
body: changelog,
});
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `${{ matrix.package }}-${version}-dist.tgz`,
data: fs.readFileSync(path.resolve("${{ matrix.package }}", "package.tgz")),
});
} catch (e) {
core.setFailed(e.message);
}
- name: Create GitHub release for KIT package
uses: actions/github-script@v6
if: matrix.package == 'drizzle-kit' && steps.checks.outputs.has_new_release == 'true'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
const fs = require("fs");
const path = require("path");
const version = "${{ steps.checks.outputs.version }}";
const changelog = fs.readFileSync("${{ steps.checks.outputs.changelog_path }}", "utf8");
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `drizzle-kit@${version}`,
name: `drizzle-kit@${version}`,
body: changelog,
});
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: `${{ matrix.package }}-${version}-dist.tgz`,
data: fs.readFileSync(path.resolve("${{ matrix.package }}", "package.tgz")),
});
} catch (e) {
core.setFailed(e.message);
}
+67
View File
@@ -0,0 +1,67 @@
name: Release Router
on:
push:
branches-ignore:
- main
pull_request:
workflow_dispatch:
inputs:
publish_to_github:
description: 'Publish to GitHub Packages instead of npm'
type: boolean
default: false
packages:
description: 'Comma-separated list of packages to publish, or "all"'
type: string
default: 'all'
jobs:
switch:
runs-on: ubuntu-24.04
outputs:
target: ${{ steps.route.outputs.target }}
steps:
- name: Route release
id: route
shell: bash
run: |
HEAD_REPO="${{ github.event.pull_request.head.repo.full_name }}"
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" && "${GITHUB_REF##*/}" == "main" ]]; then
echo "target=latest" >> $GITHUB_OUTPUT
# only run on all pushes or pull requests from forks
elif [[ "$GITHUB_EVENT_NAME" == "push" ]] || [[ "$HEAD_REPO" != "$GITHUB_REPOSITORY" ]]; then
echo "target=feature" >> $GITHUB_OUTPUT
else
echo "target=skip" >> $GITHUB_OUTPUT
fi
run-feature:
needs: switch
if: needs.switch.outputs.target == 'feature'
uses: ./.github/workflows/release-feature-branch.yaml
secrets:
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
# NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
NETLIFY_DB_URL: ${{ secrets.NETLIFY_DB_URL }}
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
LIBSQL_REMOTE_URL: ${{ secrets.LIBSQL_REMOTE_URL }}
LIBSQL_REMOTE_TOKEN: ${{ secrets.LIBSQL_REMOTE_TOKEN }}
run-latest:
needs: switch
if: needs.switch.outputs.target == 'latest'
uses: ./.github/workflows/release-latest.yaml
secrets:
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
# NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
NETLIFY_DB_URL: ${{ secrets.NETLIFY_DB_URL }}
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
LIBSQL_REMOTE_URL: ${{ secrets.LIBSQL_REMOTE_URL }}
LIBSQL_REMOTE_TOKEN: ${{ secrets.LIBSQL_REMOTE_TOKEN }}
@@ -0,0 +1,37 @@
name: Unpublish release (feature branch)
on: delete
jobs:
unpublish-release:
if: github.event.ref_type == 'branch' && github.event.ref != 'refs/heads/main' && github.event.ref != 'refs/heads/beta'
strategy:
matrix:
package:
- drizzle-orm
- drizzle-kit
- drizzle-zod
- drizzle-typebox
- drizzle-valibot
- drizzle-arktype
- eslint-plugin-drizzle
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Unpublish
run: |
tag="${{ github.event.ref }}"
tag="${tag#refs/heads/}"
echo "Unpublishing ${{ matrix.package }}@$tag"
npm dist-tag rm ${{ matrix.package }} $tag
echo "npm: \`- ${{ matrix.package }}@$tag\`" >> $GITHUB_STEP_SUMMARY
working-directory: ${{ matrix.package }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
+15
View File
@@ -0,0 +1,15 @@
node_modules
.vscode
dist
dist.new
*.tsbuildinfo
*.tgz
/*.sql
.cache
.turbo
.rollup.cache
dist-dts
rollup.config-*.mjs
*.log
.DS_Store
drizzle-seed/src/dev
+5
View File
@@ -0,0 +1,5 @@
no-inline-html: false
first-line-h1: false
line-length: false
MD010:
spaces_per_tab: 2
+1
View File
@@ -0,0 +1 @@
# prefer-workspace-packages = true
+1
View File
@@ -0,0 +1 @@
22
+128
View File
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
help@drizzle.team.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
+279
View File
@@ -0,0 +1,279 @@
# Contributing
Welcome! We're glad you're interested in Drizzle ORM and want to help us make it better.
Drizzle ORM is owned by [Drizzle Team](https://drizzle.team) and maintained by community members, mainly by our core contributors ([@AndriiSherman](https://github.com/AndriiSherman), [@AlexBlokh](https://github.com/AlexBlokh), [@dankochetov](https://github.com/dankochetov)). Everything that is going to be merged should be approved by all core contributors members.
---
There are many ways you can contribute to the Drizzle ORM project:
- [Submitting bug reports](#bug-report)
- [Submitting feature request](#feature-request)
- [Providing feedback](#feedback)
- [Contribution guidelines](#contribution-guidelines)
## <a name="bug-report"></a> Submitting bug report
To report a bug or issue, please use our [issue form](https://github.com/drizzle-team/drizzle-orm/issues/new/choose) and choose Bug Report.
## <a name="feature-request"></a> Submitting feature request
To request a feature, please use our [issue form](https://github.com/drizzle-team/drizzle-orm/issues/new/choose) and choose Feature Request.
## <a name="feedback"></a> Providing feedback
There are several ways you can provide feedback:
- You can join our [Discord server](https://discord.gg/yfjTbVXMW4) and provide feedback there.
- You can add new ticket in [Discussions](https://github.com/drizzle-team/drizzle-orm/discussions).
- Mention our [Twitter account](https://twitter.com/DrizzleOrm).
## <a name="contribution-guidelines"></a> Contribution guidelines
- [Pre-contribution setup](#pre-contribution)
- [Installing Node](#installing-node)
- [Installing pnpm](#installing-pnpm)
- [Installing Docker](#installing-docker)
- [Cloning the repository](#cloning-the-repository)
- [Repository structure](#repository-structure)
- [Building the project](#building-the-project)
- [Commit message guidelines](#commit-message-guidelines)
- [Contributing to `drizzle-orm`](#contributing-orm)
- [Project structure](#project-structure-orm)
- [Running tests](#running-tests-orm)
- [PR guidelines](#pr-guidelines-orm)
- [Contributing to `drizzle-kit`](#contributing-kit)
- [Project structure](#project-structure-kit)
- [Running tests](#running-tests-kit)
- [PR guidelines](#pr-guidelines-kit)
## <a name="pre-contribution"></a> Pre-contribution setup
### <a name="installing-node"></a> Installing Node
```bash
# https://github.com/nvm-sh/nvm#install--update-script
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm install 18.13.0
nvm use 18.13.0
```
### <a name="installing-pnpm"></a> Installing pnpm
```bash
# https://pnpm.io/installation
npm install -g pnpm
```
### <a name="installing-docker"></a> Installing Docker
```bash
# https://docs.docker.com/get-docker/
# Use Docker's guide to install Docker for your OS.
```
### <a name="cloning-the-repository"></a> Cloning the repository
```bash
git clone https://github.com/drizzle-team/drizzle-orm.git
cd drizzle-orm
```
### <a name="repository-structure"></a> Repository structure
- 📂 `drizzle-orm/`
orm core package with all main logic for each dialect
- 📂 `drizzle-kit/`
kit core package with all main logic and tests for each dialect
- 📂 `drizzle-typebox/`
all the code related to drizzle+typebox extension
- 📂 `drizzle-valibot/`
all the code related to drizzle+valibot extension
- 📂 `drizzle-zod/`
all the code related to drizzle+zod extension
- 📂 `eslint-plugin-drizzle/`
all the code related to drizzle eslint plugin
- 📂 `changelogs/`
all changelogs for drizzle-orm, drizzle-kit, drizzle-typebox, drizzle-zod, drizzle-valibot modules
- 📂 `examples/`
package with Drizzle ORM usage examples
- 📂 `integration-tests/`
package with all type of tests for each supported database
### <a name="building-the-project"></a> Building the project
Run the following script from the root folder to build the whole monorepo. Running it from a specific package folder will only build that package.
```bash
pnpm install && pnpm build
```
## <a name="commit-message-guidelines"></a> Commit message guidelines
We have specific rules on how commit messages should be structured.
It's important to make sure your commit messages are clear, concise, and informative to make it easier for others to understand the changes you are making.
All commit messages should follow the pattern below:
```
<subject>
<BLANK LINE>
<body>
```
Example:
```
Add groupBy error message
In specific case, groupBy was responding with unreadable error
...
```
> [!WARNING]
> All commits should be signed before submitting a PR. Please check the documentation on [how to sign commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification).
## <a name="contributing-orm"></a> Contributing to `drizzle-orm`
### <a name="project-structure-orm"></a> Project structure
- 📂 `pg-core/`, `mysql-core/`, `sqlite-core/`
core packages for each dialect with all the main logic for relation and query builder
- 📂 `sql/`
package containing all expressions and SQL template implementation
- All other folders are for each specific driver that Drizzle ORM supports.
### <a name="running-tests-orm"></a> Running tests
All tests for Drizzle ORM are integration tests that simulate real databases with different queries and responses from each database. Each file in `integration-tests` has a list of different scenarios for different dialects and drivers. Each file creates a Docker container with the needed database and runs the test cases there. After every test is run, the Docker container will be deleted.
If you have added additional logic to a core package, make sure that all tests completed without any failures.
> [!NOTE]
> If you have added data types or a feature for query building, you need to create additional test cases using the new API to ensure it works properly.
If you are in the root of the repository, run all integration tests with the following script:
```bash
cd integration-tests && pnpm test
```
### <a name="pr-guidelines-orm"></a> PR guidelines
1. PR titles should follow the pattern below:
```
[<dialect name>]: <subject>
```
Example:
```
[Pg] Add PostGIS extension support
```
2. PRs should contain a detailed description of everything that was changed.
3. Commit messages should follow the [message style guidelines](#commit-message-guidelines).
4. PRs should implement:
- Tests for features that were added.
- Tests for bugs that were fixed.
> [!NOTE]
> To understand how tests should be created and run, please check the [Running tests](#running-tests-orm) section.
## <a name="contributing-kit"></a> Contributing to `drizzle-kit`
### <a name="project-structure-kit"></a> Project structure
- 📂 `cli/`
- 📄 `schema.ts`
all the commands defined using brocli
- 📂 `commands/`
all the business logic for drizzle-kit commands
- 📂 `extensions/`
all the extension helpers for databases
- 📂 `serializer/`
all the necessary logic to read from the Drizzle ORM schema and convert it to a common JSON format, as well as the logic to introspect all tables, types, and other database elements and convert them to a common JSON format
- 📄 `introspect-pg.ts`, `introspect-mysql.ts`, `introspect-sqlite.ts`
these files are responsible for mapping JSON snapshots to TypeScript files during introspect commands
- 📄 `snapshotsDiffer.ts`
this file handles the mapping from JSON snapshot format to JSON statement objects.
- 📄 `jsonStatements.ts`
this file defines JSON statement types, interfaces, and helper functions.
- 📄 `sqlgenerator.ts`
this file converts JSON statements to SQL strings.
### <a name="running-tests-kit"></a> Running tests
All tests for Drizzle Kit are integration tests that simulate real databases with different queries and responses from each database. Each file in `drizzle-kit/tests` has a list of different scenarios for different commands. Each file creates a Docker container with the needed database and runs the test cases there. After every test is run, the Docker container will be deleted. We test MySQL, PostgreSQL (using PGlite), and SQLite.
If you are in the root of the repository, run all Drizzle Kit tests with the following script:
```bash
cd drizzle-kit && pnpm test
```
### <a name="pr-guidelines-kit"></a> PR guidelines
1. PR titles should follow the pattern below:
```
[<dialect name>-kit]: <subject>
```
Example:
```
[Pg-kit] Add PostGIS extension support
```
2. PRs should contain a detailed description of everything that was changed.
3. Commit messages should follow the [message style guidelines](#commit-message-guidelines).
4. PRs should implement:
- Tests for features that were added.
- Tests for bugs that were fixed.
> [!NOTE]
> To understand how tests should be created and run, please check the [Running tests](#running-tests-kit) section.
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+44
View File
@@ -0,0 +1,44 @@
<div align="center">
<img src="./misc/readme/logo-github-sq-dark.svg#gh-dark-mode-only" />
<img src="./misc/readme/logo-github-sq-light.svg#gh-light-mode-only" />
</div>
<br/>
<div align="center">
<h3>Headless ORM for NodeJS, TypeScript and JavaScript 🚀</h3>
<a href="https://orm.drizzle.team">Website</a> •
<a href="https://orm.drizzle.team/docs/overview">Documentation</a> •
<a href="https://x.com/drizzleorm">Twitter</a> •
<a href="https://driz.link/discord">Discord</a>
</div>
<br/>
<br/>
### What's Drizzle?
Drizzle is a modern TypeScript ORM developers [wanna use in their next project](https://stateofdb.com/tools/drizzle).
It is [lightweight](https://bundlephobia.com/package/drizzle-orm) at only ~7.4kb minified+gzipped, and it's tree shakeable with exactly 0 dependencies.
**Drizzle supports every PostgreSQL, MySQL and SQLite database**, including serverless ones like [Turso](https://orm.drizzle.team/docs/get-started-sqlite#turso), [Neon](https://orm.drizzle.team/docs/get-started-postgresql#neon), [Xata](https://orm.drizzle.team/docs/connect-xata), [PlanetScale](https://orm.drizzle.team/docs/get-started-mysql#planetscale), [Cloudflare D1](https://orm.drizzle.team/docs/get-started-sqlite#cloudflare-d1), [FlyIO LiteFS](https://fly.io/docs/litefs/), [Vercel Postgres](https://orm.drizzle.team/docs/get-started-postgresql#vercel-postgres), [Supabase](https://orm.drizzle.team/docs/get-started-postgresql#supabase) and [AWS Data API](https://orm.drizzle.team/docs/get-started-postgresql#aws-data-api). No bells and whistles, no Rust binaries, no serverless adapters, everything just works out of the box.
**Drizzle is serverless-ready by design**. It works in every major JavaScript runtime like NodeJS, Bun, Deno, Cloudflare Workers, Supabase functions, any Edge runtime, and even in browsers.
With Drizzle you can be [**fast out of the box**](https://orm.drizzle.team/benchmarks) and save time and costs while never introducing any data proxies into your infrastructure.
While you can use Drizzle as a JavaScript library, it shines with TypeScript. It lets you [**declare SQL schemas**](https://orm.drizzle.team/docs/sql-schema-declaration) and build both [**relational**](https://orm.drizzle.team/docs/rqb) and [**SQL-like queries**](https://orm.drizzle.team/docs/select), while keeping the balance between type-safety and extensibility for toolmakers to build on top.
### Ecosystem
While Drizzle ORM remains a thin typed layer on top of SQL, we made a set of tools for people to have best possible developer experience.
Drizzle comes with a powerful [**Drizzle Kit**](https://orm.drizzle.team/kit-docs/overview) CLI companion for you to have hassle-free migrations. It can generate SQL migration files for you or apply schema changes directly to the database.
We also have [**Drizzle Studio**](https://orm.drizzle.team/drizzle-studio/overview) for you to effortlessly browse and manipulate data in your database of choice.
### Documentation
Check out the full documentation on [the website](https://orm.drizzle.team/docs/overview).
### Our sponsors ❤️
<p align="center">
<a href="https://drizzle.team" target="_blank">
<img src='https://api.drizzle.team/v2/sponsors/svg'/>
</a>
</p>
+7
View File
@@ -0,0 +1,7 @@
# WeHub 来源说明
- 原始项目:`drizzle-team/drizzle-orm`
- 原始仓库:https://github.com/drizzle-team/drizzle-orm
- 导入方式:上游默认分支的最新快照
- 原作者、版权和许可证信息以原始仓库及本仓库 LICENSE 为准
- 本文件仅用于记录来源,不代表 WeHub 是原项目作者
+5
View File
@@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
If you have a security issue to report, please contact us at [security@drizzle.team](mailto:security@drizzle.team).
+12
View File
@@ -0,0 +1,12 @@
# Release flow
- Push feature branch
- GitHub workflow publishes new feature tag to NPM
- Bump package versions manually
- (Optional) Create and merge PR to beta
- (Optional) GitHub workflow publishes new beta version to NPM
- Create PR to main
- TODO: GitHub workflow checks if changelog is present for every package version
- Resolve all conflicts, bump versions if necessary
- Merge PR
- GitHub workflow publishes new latest version to NPM and removes feature tag from NPM
+53
View File
@@ -0,0 +1,53 @@
`drizzle-arktype` is a plugin for [Drizzle ORM](https://github.com/drizzle-team/drizzle-orm) that allows you to generate [arktype](https://arktype.io/) schemas from Drizzle ORM schemas.
**Features**
- Create a select schema for tables, views and enums.
- Create insert and update schemas for tables.
- Supports all dialects: PostgreSQL, MySQL and SQLite.
# Usage
```ts
import { pgEnum, pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
import { createInsertSchema, createSelectSchema } from 'drizzle-arktype';
import { type } from 'arktype';
const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
email: text('email').notNull(),
role: text('role', { enum: ['admin', 'user'] }).notNull(),
createdAt: timestamp('created_at').notNull().defaultNow(),
});
// Schema for inserting a user - can be used to validate API requests
const insertUserSchema = createInsertSchema(users);
// Schema for updating a user - can be used to validate API requests
const updateUserSchema = createUpdateSchema(users);
// Schema for selecting a user - can be used to validate API responses
const selectUserSchema = createSelectSchema(users);
// Overriding the fields
const insertUserSchema = createInsertSchema(users, {
role: type('string'),
});
// Refining the fields - useful if you want to change the fields before they become nullable/optional in the final schema
const insertUserSchema = createInsertSchema(users, {
id: (schema) => schema.atLeast(1),
role: type('string'),
});
// Usage
const isUserValid = parse(insertUserSchema, {
name: 'John Doe',
email: 'johndoe@test.com',
role: 'admin',
});
```
thanks @L-Mario564
+3
View File
@@ -0,0 +1,3 @@
- TS language server performance improvements
- Fixed [Buffer is not defined using drizzle-arktype client side with vite](https://github.com/drizzle-team/drizzle-orm/issues/4383)
- Fixed [[BUG]: drizzle-arktype Buffer is undefined](https://github.com/drizzle-team/drizzle-orm/issues/4371)
+2
View File
@@ -0,0 +1,2 @@
- Fixed a bug in PostgreSQL with push and introspect where the `schemaFilter` object was passed. It was detecting enums even in schemas that were not defined in the schemaFilter.
- Fixed the `drizzle-kit up` command to work as expected, starting from the sequences release.
+24
View File
@@ -0,0 +1,24 @@
## Breaking changes (for SQLite users)
#### Fixed [Composite primary key order is not consistent](https://github.com/drizzle-team/drizzle-kit-mirror/issues/342) by removing `sort` in SQLite and to be consistant with the same logic in PostgreSQL and MySQL
The issue that may arise for SQLite users with any driver using composite primary keys is that the order in the database may differ from the Drizzle schema.
- If you are using `push`, you **MAY** be prompted to update your table with a new order of columns in the composite primary key. You will need to either change it manually in the database or push the changes, but this may lead to data loss, etc.
- If you are using `generate`, you **MAY** also be prompted to update your table with a new order of columns in the composite primary key. You can either keep that migration or skip it by emptying the SQL migration file.
If nothing works for you and you are blocked, please reach out to me @AndriiSherman. I will try to help you!
## Bug fixes
- [[BUG] When using double type columns, import is not inserted](https://github.com/drizzle-team/drizzle-kit-mirror/issues/403) - thanks @Karibash
- [[BUG] A number value is specified as the default for a column of type char](https://github.com/drizzle-team/drizzle-kit-mirror/issues/404) - thanks @Karibash
- [[BUG]: Array default in migrations are wrong](https://github.com/drizzle-team/drizzle-orm/issues/2621) - thanks @L-Mario564
- [[FEATURE]: Simpler default array fields](https://github.com/drizzle-team/drizzle-orm/issues/2709) - thanks @L-Mario564
- [[BUG]: drizzle-kit generate succeeds but generates invalid SQL for default([]) - Postgres](https://github.com/drizzle-team/drizzle-orm/issues/2432) - thanks @L-Mario564
- [[BUG]: Incorrect type for array column default value](https://github.com/drizzle-team/drizzle-orm/issues/2334) - thanks @L-Mario564
- [[BUG]: error: column is of type integer[] but default expression is of type integer](https://github.com/drizzle-team/drizzle-orm/issues/2224) - thanks @L-Mario564
- [[BUG]: Default value in array generating wrong migration file](https://github.com/drizzle-team/drizzle-orm/issues/1003) - thanks @L-Mario564
- [[BUG]: enum as array, not possible?](https://github.com/drizzle-team/drizzle-orm/issues/1564) - thanks @L-Mario564
+32
View File
@@ -0,0 +1,32 @@
## Bug fixes
> Big thanks to @L-Mario564 for his [PR](https://github.com/drizzle-team/drizzle-orm/pull/2804). It conflicted in most cases with a PR that was merged, but we incorporated some of his logic. Merging it would have caused more problems and taken more time to resolve, so we just took a few things from his PR, like removing "::<type>" mappings in introspect and some array type default handlers
### What was fixed
1. The Drizzle Kit CLI was not working properly for the `introspect` command.
2. Added the ability to use column names with special characters for all dialects.
3. Included PostgreSQL sequences in the introspection process.
4. Reworked array type introspection and added all test cases.
5. Fixed all (we hope) default issues in PostgreSQL, where `::<type>` was included in the introspected output.
6. `preserve` casing option was broken
### Tickets that were closed
- [[BUG]: invalid schema generation with drizzle-kit introspect:pg](https://github.com/drizzle-team/drizzle-orm/issues/1210)
- [[BUG][mysql introspection]: TS error when introspect column including colon](https://github.com/drizzle-team/drizzle-orm/issues/1928)
- [[BUG]: Unhandled defaults when introspecting postgres db](https://github.com/drizzle-team/drizzle-orm/issues/1625)
- [[BUG]: PostgreSQL Enum Naming and Schema Typing Issue](https://github.com/drizzle-team/drizzle-orm/issues/2315)
- [[BUG]: drizzle-kit instrospect command generates syntax error on varchar column types](https://github.com/drizzle-team/drizzle-orm/issues/2714)
- [[BUG]: Introspecting varchar[] type produces syntactically invalid schema.ts](https://github.com/drizzle-team/drizzle-orm/issues/1633)
- [[BUG]: introspect:pg column not using generated enum name](https://github.com/drizzle-team/drizzle-orm/issues/1648)
- [[BUG]: drizzle-kit introspect casing "preserve" config not working](https://github.com/drizzle-team/drizzle-orm/issues/2773)
- [[BUG]: drizzle-kit introspect fails on required param that is defined](https://github.com/drizzle-team/drizzle-orm/issues/2719)
- [[BUG]: Error when running npx drizzle-kit introspect: "Expected object, received string"](https://github.com/drizzle-team/drizzle-orm/issues/2657)
- [[BUG]: Missing index names when running introspect command [MYSQL]](https://github.com/drizzle-team/drizzle-orm/issues/2525)
- [[BUG]: drizzle-kit introspect TypeError: Cannot read properties of undefined (reading 'toLowerCase')](https://github.com/drizzle-team/drizzle-orm/issues/2338)
- [[BUG]: Wrong column name when using PgEnum.array()](https://github.com/drizzle-team/drizzle-orm/issues/2100)
- [[BUG]: Incorrect Schema Generated when introspecting extisting pg database](https://github.com/drizzle-team/drizzle-orm/issues/1985)
- [[⚠️🐞BUG]: index() missing argument after introspection, causes tsc error that fails the build](https://github.com/drizzle-team/drizzle-orm/issues/1870)
- [[BUG]: drizzle-kit introspect small errors](https://github.com/drizzle-team/drizzle-orm/issues/1738)
- [[BUG]: Missing bigint import in drizzle-kit introspect](https://github.com/drizzle-team/drizzle-orm/issues/1020)
+24
View File
@@ -0,0 +1,24 @@
## New Features
### 🎉 Support for `pglite` driver
You can now use pglite with all drizzle-kit commands, including Drizzle Studio!
```ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
dialect: "postgresql",
driver: "pglite",
schema: "./schema.ts",
dbCredentials: {
url: "local-pg.db",
},
verbose: true,
strict: true,
});
```
## Bug fixes
- mysql-kit: fix GENERATED ALWAYS AS ... NOT NULL - [#2824](https://github.com/drizzle-team/drizzle-orm/pull/2824)
+180
View File
@@ -0,0 +1,180 @@
## Breaking changes and migrate guide for Turso users
If you are using Turso and libsql, you will need to upgrade your `drizzle.config` and `@libsql/client` package.
1. This version of drizzle-orm will only work with `@libsql/client@0.10.0` or higher if you are using the `migrate` function. For other use cases, you can continue using previous versions(But the suggestion is to upgrade)
To install the latest version, use the command:
```bash
npm i @libsql/client@latest
```
2. Previously, we had a common `drizzle.config` for SQLite and Turso users, which allowed a shared strategy for both dialects. Starting with this release, we are introducing the turso dialect in drizzle-kit. We will evolve and improve Turso as a separate dialect with its own migration strategies.
**Before**
```ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
dialect: "sqlite",
schema: "./schema.ts",
out: "./drizzle",
dbCredentials: {
url: "database.db",
},
breakpoints: true,
verbose: true,
strict: true,
});
```
**After**
```ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
dialect: "turso",
schema: "./schema.ts",
out: "./drizzle",
dbCredentials: {
url: "database.db",
},
breakpoints: true,
verbose: true,
strict: true,
});
```
If you are using only SQLite, you can use `dialect: "sqlite"`
## LibSQL/Turso and Sqlite migration updates
### SQLite "generate" and "push" statements updates
Starting from this release, we will no longer generate comments like this:
```sql
'/*\n SQLite does not support "Changing existing column type" out of the box, we do not generate automatic migration for that, so it has to be done manually'
+ '\n Please refer to: https://www.techonthenet.com/sqlite/tables/alter_table.php'
+ '\n https://www.sqlite.org/lang_altertable.html'
+ '\n https://stackoverflow.com/questions/2083543/modify-a-columns-type-in-sqlite3'
+ "\n\n Due to that we don't generate migration automatically and it has to be done manually"
+ '\n*/'
```
We will generate a set of statements, and you can decide if it's appropriate to create data-moving statements instead. Here is an example of the SQL file you'll receive now:
```sql
PRAGMA foreign_keys=OFF;
--> statement-breakpoint
CREATE TABLE `__new_worker` (
`id` integer PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`salary` text NOT NULL,
`job_id` integer,
FOREIGN KEY (`job_id`) REFERENCES `job`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
INSERT INTO `__new_worker`("id", "name", "salary", "job_id") SELECT "id", "name", "salary", "job_id" FROM `worker`;
--> statement-breakpoint
DROP TABLE `worker`;
--> statement-breakpoint
ALTER TABLE `__new_worker` RENAME TO `worker`;
--> statement-breakpoint
PRAGMA foreign_keys=ON;
```
### LibSQL/Turso "generate" and "push" statements updates
Since LibSQL supports more ALTER statements than SQLite, we can generate more statements without recreating your schema and moving all the data, which can be potentially dangerous for production environments.
LibSQL and Turso will now have a separate dialect in the Drizzle config file, meaning that we will evolve Turso and LibSQL independently from SQLite and will aim to support as many features as Turso/LibSQL offer.
With the updated LibSQL migration strategy, you will have the ability to:
- **Change Data Type**: Set a new data type for existing columns.
- **Set and Drop Default Values**: Add or remove default values for existing columns.
- **Set and Drop NOT NULL**: Add or remove the NOT NULL constraint on existing columns.
- **Add References to Existing Columns**: Add foreign key references to existing columns
You can find more information in the [LibSQL documentation](https://github.com/tursodatabase/libsql/blob/main/libsql-sqlite3/doc/libsql_extensions.md#altering-columns)
### LIMITATIONS
- Dropping or altering an index will cause table recreation.
This is because LibSQL/Turso does not support dropping this type of index.
```sql
CREATE TABLE `users` (
`id` integer NOT NULL,
`name` integer,
`age` integer PRIMARY KEY NOT NULL
FOREIGN KEY (`name`) REFERENCES `users1`("id") ON UPDATE no action ON DELETE no action
);
```
- If the table has indexes, altering columns will cause table recreation.
- Drizzle-Kit will drop the indexes, modify the columns, and then recreate the indexes.
- Adding or dropping composite foreign keys is not supported and will cause table recreation
### NOTES
- You can create a reference on any column type, but if you want to insert values, the referenced column must have a unique index or primary key.
```sql
CREATE TABLE parent(a PRIMARY KEY, b UNIQUE, c, d, e, f);
CREATE UNIQUE INDEX i1 ON parent(c, d);
CREATE INDEX i2 ON parent(e);
CREATE UNIQUE INDEX i3 ON parent(f COLLATE nocase);
CREATE TABLE child1(f, g REFERENCES parent(a)); -- Ok
CREATE TABLE child2(h, i REFERENCES parent(b)); -- Ok
CREATE TABLE child3(j, k, FOREIGN KEY(j, k) REFERENCES parent(c, d)); -- Ok
CREATE TABLE child4(l, m REFERENCES parent(e)); -- Error!
CREATE TABLE child5(n, o REFERENCES parent(f)); -- Error!
CREATE TABLE child6(p, q, FOREIGN KEY(p, q) REFERENCES parent(b, c)); -- Error!
CREATE TABLE child7(r REFERENCES parent(c)); -- Error!
```
> **NOTE**: The foreign key for the table child5 is an error because, although the parent key column has a unique index, the index uses a different collating sequence.
See more: https://www.sqlite.org/foreignkeys.html
## New `casing` param in `drizzle-orm` and `drizzle-kit`
There are more improvements you can make to your schema definition. The most common way to name your variables in a database and in TypeScript code is usually `snake_case` in the database and `camelCase` in the code. For this case, in Drizzle, you can now define a naming strategy in your database to help Drizzle map column keys automatically. Let's take a table from the previous example and make it work with the new casing API in Drizzle
Table can now become:
```ts
import { pgTable } from "drizzle-orm/pg-core";
export const ingredients = pgTable("ingredients", (t) => ({
id: t.uuid().defaultRandom().primaryKey(),
name: t.text().notNull(),
description: t.text(),
inStock: t.boolean().default(true),
}));
```
As you can see, `inStock` doesn't have a database name alias, but by defining the casing configuration at the connection level, all queries will automatically map it to `snake_case`
```ts
const db = await drizzle('node-postgres', { connection: '', casing: 'snake_case' })
```
For `drizzle-kit` migrations generation you should also specify `casing` param in drizzle config, so you can be sure you casing strategy will be applied to drizzle-kit as well
```ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
dialect: "postgresql",
schema: "./schema.ts",
dbCredentials: {
url: "postgresql://postgres:password@localhost:5432/db",
},
casing: "snake_case",
});
```
+122
View File
@@ -0,0 +1,122 @@
# New Features
## Checks support in `drizzle-kit`
You can use drizzle-kit to manage your `check` constraint defined in drizzle-orm schema definition
For example current drizzle table:
```ts
import { sql } from "drizzle-orm";
import { check, pgTable } from "drizzle-orm/pg-core";
export const users = pgTable(
"users",
(c) => ({
id: c.uuid().defaultRandom().primaryKey(),
username: c.text().notNull(),
age: c.integer(),
}),
(table) => ({
checkConstraint: check("age_check", sql`${table.age} > 21`),
})
);
```
will be generated into
```sql
CREATE TABLE IF NOT EXISTS "users" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"username" text NOT NULL,
"age" integer,
CONSTRAINT "age_check" CHECK ("users"."age" > 21)
);
```
The same is supported in all dialects
### Limitations
- `generate` will work as expected for all check constraint changes.
- `push` will detect only check renames and will recreate the constraint. All other changes to SQL won't be detected and will be ignored.
So, if you want to change the constraint's SQL definition using only `push`, you would need to manually comment out the constraint, `push`, then put it back with the new SQL definition and `push` one more time.
## Views support in `drizzle-kit`
You can use drizzle-kit to manage your `views` defined in drizzle-orm schema definition. It will work with all existing dialects and view options
### PostgreSQL
For example current drizzle table:
```ts
import { sql } from "drizzle-orm";
import {
check,
pgMaterializedView,
pgTable,
pgView,
} from "drizzle-orm/pg-core";
export const users = pgTable(
"users",
(c) => ({
id: c.uuid().defaultRandom().primaryKey(),
username: c.text().notNull(),
age: c.integer(),
}),
(table) => ({
checkConstraint: check("age_check", sql`${table.age} > 21`),
})
);
export const simpleView = pgView("simple_users_view").as((qb) =>
qb.select().from(users)
);
export const materializedView = pgMaterializedView(
"materialized_users_view"
).as((qb) => qb.select().from(users));
```
will be generated into
```sql
CREATE TABLE IF NOT EXISTS "users" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"username" text NOT NULL,
"age" integer,
CONSTRAINT "age_check" CHECK ("users"."age" > 21)
);
CREATE VIEW "public"."simple_users_view" AS (select "id", "username", "age" from "users");
CREATE MATERIALIZED VIEW "public"."materialized_users_view" AS (select "id", "username", "age" from "users");
```
Views supported in all dialects, but materialized views are supported only in PostgreSQL
#### Limitations
- `generate` will work as expected for all view changes
- `push` limitations:
1. If you want to change the view's SQL definition using only `push`, you would need to manually comment out the view, `push`, then put it back with the new SQL definition and `push` one more time.
## Updates for PostgreSQL enums behavior
We've updated enum behavior in Drizzle with PostgreSQL:
- Add value after or before in enum: With this change, Drizzle will now respect the order of values in the enum and allow adding new values after or before a specific one.
- Support for dropping a value from an enum: In this case, Drizzle will attempt to alter all columns using the enum to text, then drop the existing enum and create a new one with the updated set of values. After that, all columns previously using the enum will be altered back to the new enum.
> If the deleted enum value was used by a column, this process will result in a database error.
- Support for dropping an enum
- Support for moving enums between schemas
- Support for renaming enums
+1
View File
@@ -0,0 +1 @@
- Fix `data is malformed` for views
+1
View File
@@ -0,0 +1 @@
- Updated internal versions for the drizzle-kit and drizzle-orm packages. Changes were introduced in the last minor release, and you are required to upgrade both packages to ensure they work as expected
+421
View File
@@ -0,0 +1,421 @@
> This version of `drizzle-jit` requires `drizzle-orm@0.36.0` to enable all new features
# New Features
## Row-Level Security (RLS)
With Drizzle, you can enable Row-Level Security (RLS) for any Postgres table, create policies with various options, and define and manage the roles those policies apply to.
Drizzle supports a raw representation of Postgres policies and roles that can be used in any way you want. This works with popular Postgres database providers such as `Neon` and `Supabase`.
In Drizzle, we have specific predefined RLS roles and functions for RLS with both database providers, but you can also define your own logic.
### Enable RLS
If you just want to enable RLS on a table without adding policies, you can use `.enableRLS()`
As mentioned in the PostgreSQL documentation:
> If no policy exists for the table, a default-deny policy is used, meaning that no rows are visible or can be modified.
Operations that apply to the whole table, such as TRUNCATE and REFERENCES, are not subject to row security.
```ts
import { integer, pgTable } from 'drizzle-orm/pg-core';
export const users = pgTable('users', {
id: integer(),
}).enableRLS();
```
> If you add a policy to a table, RLS will be enabled automatically. So, theres no need to explicitly enable RLS when adding policies to a table.
### Roles
Currently, Drizzle supports defining roles with a few different options, as shown below. Support for more options will be added in a future release.
```ts
import { pgRole } from 'drizzle-orm/pg-core';
export const admin = pgRole('admin', { createRole: true, createDb: true, inherit: true });
```
If a role already exists in your database, and you dont want drizzle-kit to see it or include it in migrations, you can mark the role as existing.
```ts
import { pgRole } from 'drizzle-orm/pg-core';
export const admin = pgRole('admin').existing();
```
### Policies
To fully leverage RLS, you can define policies within a Drizzle table.
> In PostgreSQL, policies should be linked to an existing table. Since policies are always associated with a specific table, we decided that policy definitions should be defined as a parameter of `pgTable`
**Example of pgPolicy with all available properties**
```ts
import { sql } from 'drizzle-orm';
import { integer, pgPolicy, pgRole, pgTable } from 'drizzle-orm/pg-core';
export const admin = pgRole('admin');
export const users = pgTable('users', {
id: integer(),
}, (t) => [
pgPolicy('policy', {
as: 'permissive',
to: admin,
for: 'delete',
using: sql``,
withCheck: sql``,
}),
]);
```
**Link Policy to an existing table**
There are situations where you need to link a policy to an existing table in your database.
The most common use case is with database providers like `Neon` or `Supabase`, where you need to add a policy
to their existing tables. In this case, you can use the `.link()` API
```ts
import { sql } from "drizzle-orm";
import { pgPolicy } from "drizzle-orm/pg-core";
import { authenticatedRole, realtimeMessages } from "drizzle-orm/supabase";
export const policy = pgPolicy("authenticated role insert policy", {
for: "insert",
to: authenticatedRole,
using: sql``,
}).link(realtimeMessages);
```
### Migrations
If you are using drizzle-kit to manage your schema and roles, there may be situations where you want to refer to roles that are not defined in your Drizzle schema. In such cases, you may want drizzle-kit to skip managing these roles without having to define each role in your drizzle schema and marking it with `.existing()`.
In these cases, you can use `entities.roles` in `drizzle.config.ts`. For a complete reference, refer to the the [`drizzle.config.ts`](https://orm.drizzle.team/docs/drizzle-config-file) documentation.
By default, `drizzle-kit` does not manage roles for you, so you will need to enable this feature in `drizzle.config.ts`.
```ts {12-14}
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
dialect: 'postgresql',
schema: "./drizzle/schema.ts",
dbCredentials: {
url: process.env.DATABASE_URL!
},
verbose: true,
strict: true,
entities: {
roles: true
}
});
```
In case you need additional configuration options, let's take a look at a few more examples.
**You have an `admin` role and want to exclude it from the list of manageable roles**
```ts
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
...
entities: {
roles: {
exclude: ['admin']
}
}
});
```
**You have an `admin` role and want to include it in the list of manageable roles**
```ts
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
...
entities: {
roles: {
include: ['admin']
}
}
});
```
**If you are using `Neon` and want to exclude Neon-defined roles, you can use the provider option**
```ts
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
...
entities: {
roles: {
provider: 'neon'
}
}
});
```
**If you are using `Supabase` and want to exclude Supabase-defined roles, you can use the provider option**
```ts
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
...
entities: {
roles: {
provider: 'supabase'
}
}
});
```
> You may encounter situations where Drizzle is slightly outdated compared to new roles specified by your database provider.
In such cases, you can use the `provider` option and `exclude` additional roles:
```ts
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
...
entities: {
roles: {
provider: 'supabase',
exclude: ['new_supabase_role']
}
}
});
```
### RLS on views
With Drizzle, you can also specify RLS policies on views. For this, you need to use `security_invoker` in the view's WITH options. Here is a small example:
```ts {5}
...
export const roomsUsersProfiles = pgView("rooms_users_profiles")
.with({
securityInvoker: true,
})
.as((qb) =>
qb
.select({
...getTableColumns(roomsUsers),
email: profiles.email,
})
.from(roomsUsers)
.innerJoin(profiles, eq(roomsUsers.userId, profiles.id))
);
```
### Using with Neon
The Neon Team helped us implement their vision of a wrapper on top of our raw policies API. We defined a specific
`/neon` import with the `crudPolicy` function that includes predefined functions and Neon's default roles.
Here's an example of how to use the `crudPolicy` function:
```ts
import { crudPolicy } from 'drizzle-orm/neon';
import { integer, pgRole, pgTable } from 'drizzle-orm/pg-core';
export const admin = pgRole('admin');
export const users = pgTable('users', {
id: integer(),
}, (t) => [
crudPolicy({ role: admin, read: true, modify: false }),
]);
```
This policy is equivalent to:
```ts
import { sql } from 'drizzle-orm';
import { integer, pgPolicy, pgRole, pgTable } from 'drizzle-orm/pg-core';
export const admin = pgRole('admin');
export const users = pgTable('users', {
id: integer(),
}, (t) => [
pgPolicy(`crud-${admin.name}-policy-insert`, {
for: 'insert',
to: admin,
withCheck: sql`false`,
}),
pgPolicy(`crud-${admin.name}-policy-update`, {
for: 'update',
to: admin,
using: sql`false`,
withCheck: sql`false`,
}),
pgPolicy(`crud-${admin.name}-policy-delete`, {
for: 'delete',
to: admin,
using: sql`false`,
}),
pgPolicy(`crud-${admin.name}-policy-select`, {
for: 'select',
to: admin,
using: sql`true`,
}),
]);
```
`Neon` exposes predefined `authenticated` and `anaonymous` roles and related functions. If you are using `Neon` for RLS, you can use these roles, which are marked as existing, and the related functions in your RLS queries.
```ts
// drizzle-orm/neon
export const authenticatedRole = pgRole('authenticated').existing();
export const anonymousRole = pgRole('anonymous').existing();
export const authUid = (userIdColumn: AnyPgColumn) => sql`(select auth.user_id() = ${userIdColumn})`;
```
For example, you can use the `Neon` predefined roles and functions like this:
```ts
import { sql } from 'drizzle-orm';
import { authenticatedRole } from 'drizzle-orm/neon';
import { integer, pgPolicy, pgRole, pgTable } from 'drizzle-orm/pg-core';
export const admin = pgRole('admin');
export const users = pgTable('users', {
id: integer(),
}, (t) => [
pgPolicy(`policy-insert`, {
for: 'insert',
to: authenticatedRole,
withCheck: sql`false`,
}),
]);
```
### Using with Supabase
We also have a `/supabase` import with a set of predefined roles marked as existing, which you can use in your schema.
This import will be extended in a future release with more functions and helpers to make using RLS and `Supabase` simpler.
```ts
// drizzle-orm/supabase
export const anonRole = pgRole('anon').existing();
export const authenticatedRole = pgRole('authenticated').existing();
export const serviceRole = pgRole('service_role').existing();
export const postgresRole = pgRole('postgres_role').existing();
export const supabaseAuthAdminRole = pgRole('supabase_auth_admin').existing();
```
For example, you can use the `Supabase` predefined roles like this:
```ts
import { sql } from 'drizzle-orm';
import { serviceRole } from 'drizzle-orm/supabase';
import { integer, pgPolicy, pgRole, pgTable } from 'drizzle-orm/pg-core';
export const admin = pgRole('admin');
export const users = pgTable('users', {
id: integer(),
}, (t) => [
pgPolicy(`policy-insert`, {
for: 'insert',
to: serviceRole,
withCheck: sql`false`,
}),
]);
```
The `/supabase` import also includes predefined tables and functions that you can use in your application
```ts
// drizzle-orm/supabase
const auth = pgSchema('auth');
export const authUsers = auth.table('users', {
id: uuid().primaryKey().notNull(),
});
const realtime = pgSchema('realtime');
export const realtimeMessages = realtime.table(
'messages',
{
id: bigserial({ mode: 'bigint' }).primaryKey(),
topic: text().notNull(),
extension: text({
enum: ['presence', 'broadcast', 'postgres_changes'],
}).notNull(),
},
);
export const authUid = sql`(select auth.uid())`;
export const realtimeTopic = sql`realtime.topic()`;
```
This allows you to use it in your code, and Drizzle Kit will treat them as existing databases,
using them only as information to connect to other entities
```ts
import { foreignKey, pgPolicy, pgTable, text, uuid } from "drizzle-orm/pg-core";
import { sql } from "drizzle-orm/sql";
import { authenticatedRole, authUsers } from "drizzle-orm/supabase";
export const profiles = pgTable(
"profiles",
{
id: uuid().primaryKey().notNull(),
email: text().notNull(),
},
(table) => [
foreignKey({
columns: [table.id],
// reference to the auth table from Supabase
foreignColumns: [authUsers.id],
name: "profiles_id_fk",
}).onDelete("cascade"),
pgPolicy("authenticated can view all profiles", {
for: "select",
// using predefined role from Supabase
to: authenticatedRole,
using: sql`true`,
}),
]
);
```
Let's check an example of adding a policy to a table that exists in `Supabase`
```ts
import { sql } from "drizzle-orm";
import { pgPolicy } from "drizzle-orm/pg-core";
import { authenticatedRole, realtimeMessages } from "drizzle-orm/supabase";
export const policy = pgPolicy("authenticated role insert policy", {
for: "insert",
to: authenticatedRole,
using: sql``,
}).link(realtimeMessages);
```
# Bug fixes
- [[BUG]: Studio + mysql default mode, wrong format related timezone](https://github.com/drizzle-team/drizzle-orm/issues/2747)
- [[BUG]: Drizzle Studio CORS error](https://github.com/drizzle-team/drizzle-orm/issues/1857)
- [[BUG]: TIMESTAMPS showing up incorrectly on drizzle studio](https://github.com/drizzle-team/drizzle-orm/issues/2549)
+1
View File
@@ -0,0 +1 @@
- Fix: [[BUG]: When using RLS policies and Views, the view is the last clause generated](https://github.com/drizzle-team/drizzle-orm/issues/3378)
+3
View File
@@ -0,0 +1,3 @@
- Fix [[BUG]: Undefined properties when using drizzle-kit push](https://github.com/drizzle-team/drizzle-orm/issues/3391)
- Fix TypeError: Cannot read properties of undefined (reading 'isRLSEnabled')
- Fix push bugs, when pushing a schema with linked policy to a table from `drizzle-orm/supabase`
+28
View File
@@ -0,0 +1,28 @@
# Improvements
- Added an OHM static imports checker to identify unexpected imports within a chain of imports in the drizzle-kit repo. For example, it checks if drizzle-orm is imported before drizzle-kit and verifies if the drizzle-orm import is available in your project.
- [Adding more columns to Supabase auth.users table schema](https://github.com/drizzle-team/drizzle-orm/issues/3327) - thanks @nicholasdly
# Bug Fixes
- [[BUG]: [drizzle-kit]: Fix breakpoints option cannot be disabled](https://github.com/drizzle-team/drizzle-orm/issues/2828) - thanks @klotztech
- [[BUG]: drizzle-kit introspect: SMALLINT import missing and incorrect DECIMAL UNSIGNED handling](https://github.com/drizzle-team/drizzle-orm/issues/2950) - thanks @L-Mario564
- [Unsigned tinyints preventing migrations](https://github.com/drizzle-team/drizzle-orm/issues/1571) - thanks @L-Mario564
- [[BUG]: Can't parse float(8,2) from database (precision and scale and/or unsigned breaks float types)](https://github.com/drizzle-team/drizzle-orm/issues/3285) - thanks @L-Mario564
- [[BUG]: PgEnum generated migration doesn't escape single quotes](https://github.com/drizzle-team/drizzle-orm/issues/1272) - thanks @L-Mario564
- [[BUG]: single quote not escaped correctly in migration file](https://github.com/drizzle-team/drizzle-orm/issues/2184) - thanks @L-Mario564
- [[BUG]: Migrations does not escape single quotes](https://github.com/drizzle-team/drizzle-orm/issues/1765) - thanks @L-Mario564
- [[BUG]: Issue with quoted default string values](https://github.com/drizzle-team/drizzle-orm/issues/2122) - thanks @L-Mario564
- [[BUG]: SQl commands in wrong roder](https://github.com/drizzle-team/drizzle-orm/issues/2390) - thanks @L-Mario564
- [[BUG]: Time with precision in drizzle-orm/pg-core adds double-quotes around type](https://github.com/drizzle-team/drizzle-orm/issues/1804) - thanks @L-Mario564
- [[BUG]: Postgres push fails due to lack of quotes](https://github.com/drizzle-team/drizzle-orm/issues/2396) - thanks @L-Mario564
- [[BUG]: TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')](https://github.com/drizzle-team/drizzle-orm/issues/2344) - thanks @L-Mario564
- [[BUG]: drizzle-kit introspect generates CURRENT_TIMESTAMP without sql operator on date column](https://github.com/drizzle-team/drizzle-orm/issues/2899) - thanks @L-Mario564
- [[BUG]: Drizzle-kit introspect doesn't pull correct defautl statement](https://github.com/drizzle-team/drizzle-orm/issues/2905) - thanks @L-Mario564
- [[BUG]: Problem on MacBook - This statement does not return data. Use run() instead](https://github.com/drizzle-team/drizzle-orm/issues/2623) - thanks @L-Mario564
- [[BUG]: Enum column names that are used as arrays are not quoted](https://github.com/drizzle-team/drizzle-orm/issues/2598) - thanks @L-Mario564
- [[BUG]: drizzle-kit generate ignores index operators](https://github.com/drizzle-team/drizzle-orm/issues/2935) - thanks @L-Mario564
- [dialect param config error message is wrong](https://github.com/drizzle-team/drizzle-orm/issues/3427) - thanks @L-Mario564
- [[BUG]: Error setting default enum field values](https://github.com/drizzle-team/drizzle-orm/issues/2299) - thanks @L-Mario564
- [[BUG]: drizzle-kit does not respect the order of columns configured in primaryKey()](https://github.com/drizzle-team/drizzle-orm/issues/2326) - thanks @L-Mario564
- [[BUG]: Cannot drop Unique Constraint MySQL](https://github.com/drizzle-team/drizzle-orm/issues/998) - thanks @L-Mario564
+4
View File
@@ -0,0 +1,4 @@
# Bug fixes
- Fixed typos in repository: thanks @armandsalle, @masto, @wackbyte, @Asher-JH, @MaxLeiter
- [fix: wrong dialect set in mysql/sqlite introspect](https://github.com/drizzle-team/drizzle-orm/pull/2865)
+40
View File
@@ -0,0 +1,40 @@
# New Dialects
### 🎉 `SingleStore` dialect is now available in Drizzle
Thanks to the SingleStore team for creating a PR with all the necessary changes to support the MySQL-compatible part of SingleStore. You can already start using it with Drizzle. The SingleStore team will also help us iterate through updates and make more SingleStore-specific features available in Drizzle
```ts
import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
dialect: 'singlestore',
out: './drizzle',
schema: './src/db/schema.ts',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
});
```
You can check out our [Getting started guides](https://orm.drizzle.team/docs/get-started/singlestore-new) to try SingleStore!
# New Drivers
### 🎉 `SQLite Durable Objects` driver is now available in Drizzle
You can now query SQLite Durable Objects in Drizzle!
For the full example, please check our [Get Started](https://orm.drizzle.team/docs/get-started/do-new) Section
```ts
import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
out: './drizzle',
schema: './src/db/schema.ts',
dialect: 'sqlite',
driver: 'durable-sqlite',
});
```
+1
View File
@@ -0,0 +1 @@
- Fix SingleStore generate migrations command
+7
View File
@@ -0,0 +1,7 @@
Starting from this update, the PostgreSQL dialect will align with the behavior of all other dialects. It will no longer include `IF NOT EXISTS`, `$DO`, or similar statements, which could cause incorrect DDL statements to not fail when an object already exists in the database and should actually fail.
This change marks our first step toward several major upgrades we are preparing:
- An updated and improved migration workflow featuring commutative migrations, a revised folder structure, and enhanced collaboration capabilities for migrations.
- Better support for Xata migrations.
- Compatibility with CockroachDB (achieving full compatibility will only require removing serial fields from the migration folder).
+35
View File
@@ -0,0 +1,35 @@
# New Features
### `drizzle-kit export`
To make drizzle-kit integration with other migration tools, like Atlas much easier, we've prepared a new command called `export`. It will translate your drizzle schema in SQL representation(DDL) statements and outputs to the console
```ts
// schema.ts
import { pgTable, serial, text } from 'drizzle-orm/pg-core'
export const users = pgTable('users', {
id: serial('id').primaryKey(),
email: text('email').notNull(),
name: text('name')
});
```
Running
```bash
npx drizzle-kit export
```
will output this string to console
```bash
CREATE TABLE "users" (
"id" serial PRIMARY KEY NOT NULL,
"email" text NOT NULL,
"name" text
);
```
By default, the only option for now is `--sql`, so the output format will be SQL DDL statements. In the future, we will support additional output formats to accommodate more migration tools
```bash
npx drizzle-kit export --sql
```
+1
View File
@@ -0,0 +1 @@
- Fix certificates generation utility for Drizzle Studio; [[BUG]: [drizzle-kit]: drizzle-kit dependency on drizzle-studio perms error](https://github.com/drizzle-team/drizzle-orm/issues/3729)
+7
View File
@@ -0,0 +1,7 @@
# SingleStore `push` and `generate` improvements
As SingleStore did not support certain DDL statements before this release, you might encounter an error indicating that some schema changes cannot be applied due to a database issue. Starting from this version, drizzle-kit will detect such cases and initiate table recreation with data transfer between the tables
# Bug fixes
- [[BUG] If the index name is the same as the generated name, it will be empty and a type error will occur](https://github.com/drizzle-team/drizzle-orm/issues/3420)
+2
View File
@@ -0,0 +1,2 @@
- Fix bug that generates incorrect syntax when introspect in mysql
- Fix a bug that caused incorrect syntax output when introspect in unsigned columns
+30
View File
@@ -0,0 +1,30 @@
# New Features
## Added `Gel` dialect support and `gel-js` client support
Drizzle is getting a new `Gel` dialect with its own types and Gel-specific logic. In this first iteration, almost all query-building features have been copied from the `PostgreSQL` dialect since Gel is fully PostgreSQL-compatible. The only change in this iteration is the data types. The Gel dialect has a different set of available data types, and all mappings for these types have been designed to avoid any extra conversions on Drizzle's side. This means you will insert and select exactly the same data as supported by the Gel protocol.
Drizzle + Gel integration will work only through `drizzle-kit pull`. Drizzle won't support `generate`, `migrate`, or `push` features in this case. Instead, drizzle-kit is used solely to pull the Drizzle schema from the Gel database, which can then be used in your `drizzle-orm` queries.
The Gel + Drizzle workflow:
1. Use the `gel` CLI to manage your schema.
2. Use the `gel` CLI to generate and apply migrations to the database.
3. Use drizzle-kit to pull the Gel database schema into a Drizzle schema.
4. Use drizzle-orm with gel-js to query the Gel database.
On the drizzle-kit side you can now use `dialect: "gel"`
```ts
// drizzle.config.ts
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
dialect: 'gel',
});
```
For a complete Get Started tutorial you can use our new guides:
- [Get Started with Drizzle and Gel in a new project](https://orm.drizzle.team/docs/get-started/gel-new)
- [Get Started with Drizzle and Gel in a existing project](https://orm.drizzle.team/docs/get-started/gel-existing)
+4
View File
@@ -0,0 +1,4 @@
### Bug fixes
- [[BUG]: d1 push locally is not working](https://github.com/drizzle-team/drizzle-orm/issues/4099) - thanks @mabels and @RomanNabukhotnyi
- [[BUG] Cloudflare D1: drizzle-kit push is not working (error 7500 SQLITE_AUTH)](https://github.com/drizzle-team/drizzle-orm/issues/3728) - thanks @mabels and @RomanNabukhotnyi
+31
View File
@@ -0,0 +1,31 @@
## Features and improvements
### Enum DDL improvements
For situations where you drop an `enum` value or reorder values in an `enum`, there is no native way to do this in PostgreSQL. To handle these cases, `drizzle-kit` used to:
- Change the column data types from the enum to text
- Drop the old enum
- Add the new enum
- Change the column data types back to the new enum
However, there were a few scenarios that werent covered: `PostgreSQL` wasnt updating default expressions for columns when their data types changed
Therefore, for cases where you either change a columns data type from an `enum` to some other type, drop an `enum` value, or reorder `enum` values, we now do the following:
- Change the column data types from the enum to text
- Set the default using the ::text expression
- Drop the old enum
- Add the new enum
- Change the column data types back to the new enum
- Set the default using the ::<new_enum> expression
### `esbuild` version upgrade
For `drizzle-kit` we upgraded the version to latest (`0.25.2`), thanks @paulmarsicloud
## Bug fixes
- [[BUG]: Error on Malformed Array Literal](https://github.com/drizzle-team/drizzle-orm/issues/2715) - thanks @Kratious
- [[BUG]: Postgres drizzle-kit: Error while pulling indexes from a table with json/jsonb deep field index](https://github.com/drizzle-team/drizzle-orm/issues/2744) - thanks @Kratious
- [goog-vulnz flags CVE-2024-24790 in esbuild 0.19.7](https://github.com/drizzle-team/drizzle-orm/issues/4045)
+18
View File
@@ -0,0 +1,18 @@
### Fixed `drizzle-kit pull` bugs when using Gel extensions.
Because Gel extensions create schema names containing `::` (for example, `ext::auth`), Drizzle previously handled these names incorrectly. Starting with this release, you can use Gel extensions without any problems. Heres what you should do:
1. Enable extensions schemas in `drizzle.config.ts`
```ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
dialect: 'gel',
schemaFilter: ['ext::auth', 'public']
});
```
2. Run `drizzle-kit pull`
3. Done!
+3
View File
@@ -0,0 +1,3 @@
- Updated to `hanji@0.0.8` - native bun `stringWidth`, `stripANSI` support, errors for non-TTY environments
- We've migrated away from `esbuild-register` to `tsx` loader, it will now allow to use `drizzle-kit` seamlessly with both `ESM` and `CJS` modules
- We've also added native `Bun` and `Deno` launch support, which will not trigger `tsx` loader and utilise native `bun` and `deno` imports capabilities and faster startup times
+3
View File
@@ -0,0 +1,3 @@
### Bug fixes
- Fixed relations extraction to not interfere with Drizzle Studio.
+1
View File
@@ -0,0 +1 @@
- Internal changes to Studio context. Added `databaseName` and `packageName` properties for Studio
+1
View File
@@ -0,0 +1 @@
- Fixed `halfvec`, `bit` and `sparsevec` type generation bug in drizzle-kit
+1
View File
@@ -0,0 +1 @@
- Add casing support to studio configuration and related functions
+3
View File
@@ -0,0 +1,3 @@
### Bug fixes
- [[BUG]: Importing drizzle-kit/api fails in ESM modules](https://github.com/drizzle-team/drizzle-orm/issues/2853)
+3
View File
@@ -0,0 +1,3 @@
### Bug fixes
- [[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)
+4
View File
@@ -0,0 +1,4 @@
### Bug fixes
- Fixed `algorythm` => `algorithm` typo.
- Fixed external dependencies in build configuration.
+1
View File
@@ -0,0 +1 @@
- drizzle-kit api improvements for D1 connections
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-mysql 0.14.1
- Release support for mysql. Currently mysql module is up-to-date with `pg` and `sqlite`
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-mysql 0.14.2
- Bumped everything to 0.14.2
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-mysql 0.14.3
- Fill author field in package.json
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-mysql 0.15.0
- Bumped everything to 0.15.0
+88
View File
@@ -0,0 +1,88 @@
# drizzle-orm-mysql 0.15.1
Add support for schemas -> [MySQL schemas](https://dev.mysql.com/doc/refman/8.0/en/create-database.html)
> **Warning**
> If you will have tables with same names in different schemas then drizzle will respond with `never[]` error in result types and error from database
>
> In this case you may use [alias syntax](https://github.com/drizzle-team/drizzle-orm/tree/main/drizzle-orm-mysql#join-aliases-and-self-joins)
---
Usage example
```typescript
// Table in default schema
const publicUsersTable = mysqlTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
verified: boolean('verified').notNull().default(false),
jsonb: json<string[]>('jsonb'),
createdAt: timestamp('created_at', { fsp: 2 }).notNull().defaultNow(),
});
// Table in custom schema
const mySchema = mysqlSchema('mySchema');
const mySchemaUsersTable = mySchema('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
verified: boolean('verified').notNull().default(false),
jsonb: json<string[]>('jsonb'),
createdAt: timestamp('created_at', { fsp: 2 }).notNull().defaultNow(),
});
```
---
## Breaking changes
- `foreignKey()` function api changes. Previously you need to pass callback function with table columns for FK. Right now no need for callback, just object with data for FK
#### Before
```typescript
export const usersTable = mysqlTable('userstest', {
id: serial('id').primaryKey(),
homeCity: text('name').notNull(),
createdAt: timestamp('created_at', { fsp: 2 }).notNull().defaultNow(),
}, (users) => ({
// foreignKey has a callback as param
usersCityFK: foreignKey(() => { columns: [users.homeCity], foreignColumns: [cities.id] }),
}));
```
#### Now
```typescript
export const usersTable = mysqlTable('userstest', {
id: serial('id').primaryKey(),
homeCity: text('name').notNull(),
createdAt: timestamp('created_at', { fsp: 2 }).notNull().defaultNow(),
}, (users) => ({
// foreignKey has a callback as param
usersCityFK: foreignKey({ columns: [users.homeCity], foreignColumns: [cities.id] }),
}));
```
---
- Change enum initializing strategy for mysql
You should use
``` typescript
mysqlEnum('popularity', ['unknown', 'known', 'popular']).notNull().default('known')
```
instead of
``` typescript
export const popularityEnum = mysqlEnum('popularity', ['unknown', 'known', 'popular']);
popularityEnum('column_name');
```
Usage example in table schema
``` typescript
const tableWithEnums = mysqlTable('enums_test_case', {
id: serial('id').primaryKey(),
enum1: mysqlEnum('enum1', ['a', 'b', 'c']).notNull(),
enum2: mysqlEnum('enum2', ['a', 'b', 'c']).default('a'),
enum3: mysqlEnum('enum3', ['a', 'b', 'c']).notNull().default('b'),
});
```
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-mysql 0.15.2
Internal release
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-mysql 0.15.3
Internal release
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-mysql 0.16.0
- Bump all packages to 0.16.0
+19
View File
@@ -0,0 +1,19 @@
# drizzle-orm-mysql 0.16.1
- Add possibility to define database custom data types
Example usage:
```typescript
const customText = customType<{ data: string }>({
dataType() {
return 'text';
},
});
const usersTable = mysqlTable('users', {
name: customText('name').notNull(),
});
```
For more examples please check [docs](https://github.com/drizzle-team/drizzle-orm/blob/main/docs/custom-types.lite.md)
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-mysql 0.16.2
- Fix peer dependency error for >=0.16 drizzle packages
@@ -0,0 +1,8 @@
# drizzle-orm-pg 0.12.0-beta.40
- Added prepared statements and placeholders support.
- Refactored `.select().fields()` to allow fields from joined tables and nested objects structure, removed partial selects from joins.
- Allowed passing query builders to `db.execute`.
- Optimized INSERT query generation for single values by skipping columns without values.
- Exposed `table` property from index config.
- Removed testing utils.
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.13.0
- Release 🎉
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.13.1
- Implemented node-pg prepared statements usage via adding `name` argument to `.prepare()` method.
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.13.2
- Fix prepared statements usage.
+4
View File
@@ -0,0 +1,4 @@
# drizzle-orm-pg 0.13.3
- Implemented NeonDB serverless driver support.
- (internal) Added `session.all()` and `session.values()` methods.
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.13.4
- Fixed types for IndexBuilder.
+8
View File
@@ -0,0 +1,8 @@
# drizzle-orm-pg 0.14.0
- Separated migrations functionality to a separate import:
```typescript
import { migrate } from 'drizzle-orm-pg/node/migrate';
```
- Replaced `await new PgConnector(client).connect()` with `drizzle(client)`.
- `import { PgConnector } from 'drizzle-orm-pg` -> `import { drizzle } from 'drizzle-orm-pg/node`.
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.14.1
- Bumped everything to 0.14.1.
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.14.2
- Bumped everything to 0.14.2
+6
View File
@@ -0,0 +1,6 @@
# drizzle-orm-pg 0.14.3
- Fixed `.onConflict` statement query builder. In previous versions target column was mapped together with table name
- Added documentation examples for `onConflict`
- Added documentation examples for returning statements for insert/update/delete
- Add more tests for `onConflict` query builder
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.14.4
- Fill author field in package.json
+41
View File
@@ -0,0 +1,41 @@
# drizzle-orm-pg 0.15.0
- Set `notNull` to `true` in runtime, when `.primaryKey()` function was used in `ColumnBuilder`
- Set `no action` for `OnDelete` and `OnUpdate` in runtime by default
- Add internal version for ORM api
- Index name now becomes optional. You can write either `index('usersNameIdx')` or `index()`. In last case, drizzle will generate index name automatically based on table and column index was created on
## Breaking changes
`foreignKey()` function api changes. Previosuly you need to pass callback function with table columns for FK. Right now no need for callback, just object with data for FK
#### Before
```typescript
export const usersTable = pgTable(
'users_table',
{
id: serial('id').primaryKey(),
uuid: uuid('uuid').defaultRandom().notNull(),
homeCity: integer('home_city').notNull()
},
(users) => ({
// foreignKey had a callback as param
usersCityFK: foreignKey(() => ({ columns: [users.homeCity], foreignColumns: [cities.id] })),
}),
);
```
#### Now
```typescript
export const usersTable = pgTable(
'users_table',
{
id: serial('id').primaryKey(),
uuid: uuid('uuid').defaultRandom().notNull(),
homeCity: integer('home_city').notNull()
},
(users) => ({
// foreignKey doesn't have a callback as param
usersCityFK: foreignKey({ columns: [users.homeCity], foreignColumns: [cities.id] }),
}),
);
```
+39
View File
@@ -0,0 +1,39 @@
# drizzle-orm-pg 0.15.1
Add support for schemas -> [PostgreSQL schemas](https://www.postgresql.org/docs/current/ddl-schemas.html)
---
Drizzle won't append any schema before table definition by default. So if your tables are in `public` schema drizzle generate -> `select * from "users"`
But if you will specify any custom schema you want, then drizzle will generate -> `select * from "custom_schema"."users"`
> **Warning**
> If you will have tables with same names in different schemas then drizzle will respond with `never[]` error in result types and error from database
>
> In this case you may use [alias syntax](https://github.com/drizzle-team/drizzle-orm/tree/main/drizzle-orm-pg#join-aliases-and-self-joins)
---
Usage example
```typescript
// Table in default schema
const publicUsersTable = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
verified: boolean('verified').notNull().default(false),
jsonb: jsonb<string[]>('jsonb'),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
});
// Table in custom schema
const mySchema = pgSchema('mySchema');
const usersTable = mySchema('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
verified: boolean('verified').notNull().default(false),
jsonb: jsonb<string[]>('jsonb'),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
});
```
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.15.2
Internal release
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.15.3
Internal release
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.16.0
- Implemented [postgres.js](https://github.com/porsager/postgres) driver support ([docs](/drizzle-orm-pg/src/postgres-js/README.md))
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.16.1
- Fix documentation links
+17
View File
@@ -0,0 +1,17 @@
- Add possibility to define database custom data types
Example usage:
```typescript
const customText = customType<{ data: string }>({
dataType() {
return 'text';
},
});
const usersTable = pgTable('users', {
name: customText('name').notNull(),
});
```
For more examples please check [docs](https://github.com/drizzle-team/drizzle-orm/blob/main/docs/custom-types.lite.md)
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-pg 0.16.3
- Fix peer dependency error for >=0.16 drizzle packages
@@ -0,0 +1,4 @@
# drizzle-orm-sqlite 0.12.0-beta.17
- Refactored `.select().fields()` to allow fields from joined tables and nested objects structure, removed partial selects from joins.
- Replaced `.execute()` in query builders and prepared statements with `.run()`, `.all()`, `.get()`, `.values()`.
@@ -0,0 +1,3 @@
# drizzle-orm-sqlite 0.12.0-beta.18
- Updated `better-sqlite3` and `@types/better-sqlite3` peer dependency from `<8` to `<9`.
@@ -0,0 +1,3 @@
# drizzle-orm-sqlite 0.12.0-beta.19
- Fix bug with running migrations. `Error: SqliteError: near "SCHEMA": syntax error` was fixed
@@ -0,0 +1,4 @@
# drizzle-orm-sqlite 0.12.0-beta.20
- Fix bug with running migrations for async driver. `Error: SqliteError: near "SCHEMA": syntax error` was fixed
- Fix `Statement does not return any data - use run()` error, when no fields were provided to prepared statement
@@ -0,0 +1,6 @@
# drizzle-orm-sqlite 0.12.0-beta.21
- Fixed `db.all` logic for all drivers.
- Allowed passing query builders to raw query execution methods.
- Optimized INSERT query generation for single values by skipping columns without values.
- Exposed `table` property from index config.
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-sqlite 0.13.0
- Release 🎉
+8
View File
@@ -0,0 +1,8 @@
# drizzle-orm-sqlite 0.14.1
- Separated migrations functionality to a separate import:
```typescript
import { migrate } from 'drizzle-orm-sqlite/better-sqlite3/migrate';
```
- Replaced `await new SQLiteConnector(client).connect()` with `drizzle(client)`.
- `import { SQLiteConnector } from 'drizzle-orm-sqlite` -> `import { drizzle } from 'drizzle-orm-pg/better-sqlite3`.
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-sqlite 0.14.2
- Bumped everything to 0.14.2
+19
View File
@@ -0,0 +1,19 @@
# drizzle-orm-sqlite 0.14.3
- `RangeError: The supplied SQL string contains more than one statement` error on migrations was fixed
Created `.exec()` method for session, that will run query without prepared statments
- Fix `defaultNow()` method query generation by adding missin `"()"`.
Previously default value was generated as
```sql
cast((julianday('now') - 2440587.5)*86400000 as integer)
```
Currently default value looks like
```sql
(cast((julianday('now') - 2440587.5)*86400000 as integer))
```
- Create test cases for both issues
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-sqlite 0.14.4
- Fix adding autoincrement to `drizzle-kit` migrations
+4
View File
@@ -0,0 +1,4 @@
# drizzle-orm-sqlite 0.14.5
- Remove upper bound restriction from `@cloudflare/workers-types` peer dependency
- Fill author field in package.json
+14
View File
@@ -0,0 +1,14 @@
# drizzle-orm-sqlite 0.15.0
- Add composite PK's on table schema definition
#### Usage example
```typescript
const pkExample = sqliteTable('pk_example', {
id: integer('id'),
name: text('name').notNull(),
email: text('email').notNull(),
}, (table) => ({
compositePk: primaryKey(table.id, table.name)
}));
```
+3
View File
@@ -0,0 +1,3 @@
# drizzle-orm-sqlite 0.15.2
Internal release

Some files were not shown because too many files have changed in this diff Show More