npm drizzle-kit 0.20.0

latest releases: 0.28.0-8366cca, 0.28.0-cc4f208, 0.28.0-9859e8e...
12 months ago

Drizzle ORM version 0.29.0 will require a minimum Drizzle Kit version of 0.20.0, and vice versa. Therefore, when upgrading to a newer version of Drizzle ORM, you will also need to upgrade Drizzle Kit. This may result in some breaking changes throughout the versions, especially if you need to upgrade Drizzle Kit and your Drizzle ORM version is older than <0.28.0

New Features

New way to define drizzle.config using defineConfig function

import { defineConfig } from 'drizzle-kit'

export default defineConfig({
  schema: "./schema.ts",
  out: "./drizzle",
  driver: "..",
  dbCredentials: {
    // connection
  },
  verbose: true,
  strict: true,
})

Possibility to access Cloudflare D1 with Drizzle Studio using wrangler.toml file

You can now use Drizzle Studio with your D1 database. Please note that it may be slow at times because Drizzle Studio utilizes Wrangler CLI calls to perform data selection, updates, deletions, and insertions. The speed of these operations depends on the performance of Wrangler CLI calls.

To use Drizzle Studio with the D1 database, you need to provide the file path to your wrangler.toml file and specify the dbName you are using in Cloudflare D1

import { defineConfig } from 'drizzle-kit'

export default defineConfig({
  schema: "./schema.ts",
  out: "./drizzle",
  driver: "d1",
  dbCredentials: {
    wranglerConfigPath: 'wrangler.toml',
    dbName: 'd1-test'
  },
  verbose: true,
  strict: true,
})

And then run drizzle-kit studio

Note: make sure you have wrangler cli installed globally or inside your project and you invoked wrangler login before running studio

Drizzle Studio is migrating to https://local.drizzle.studio/

Previously, Drizzle Studio used 127.0.0.1:4983 as the default host and port for the web page. Currently, Drizzle Studio will always be hosted on https://local.drizzle.studio/, connecting to the backend at 127.0.0.1:4983. You can modify the host and port for the backend server by using the --host and --port options in drizzle-kit studio.

local.drizzle.studio provides the ability to ship updates to the Drizzle Studio web UI immediately, eliminating the need for constant drizzle-kit upgrades

bigint unsigned support

This option is now available in the introspect, push, and generate commands.

primaryKeys and foreignKeys now can have custom names

This option is now available in the introspect, push, and generate commands.

Environment variables are now fetched automatically

As mentioned many times, you can finally skip fetching environment variables to use with the drizzle.config file. Drizzle Kit will handle this process automatically.

Drizzle Studio Updates

  • Refresh button for the view inside a table.
  • Possibility to choose schemas for Postgres. For MySQL and SQLite, public will be the default, and the only choice.

Improvements

  • remove libsql_wasm_func_table from sqlite introspect and push
  • Handle primaryKey columns order for composite constraints

Bug Fixes

  • Fix the case, when having turso or libsql driver user was seeing an error with no better-sqlite3 dependency
  • Add tableFilters to cli options in all push commands
  • Fix dropping unique indexes syntax for push and generate command

Don't miss a new drizzle-kit release

NewReleases is sending notifications on new releases.