Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Releases: drizzle-team/drizzle-kit-mirror

0.19.2

21 Jun 15:19
edfae9e
Compare
Choose a tag to compare

😢 Reverted ESM support part in drizzle-kit to unblock upgrade possibilities. We will be working on improvements on another branch at a pace that suits us so that we can ensure we are not blocking anyone

🐛 Config type for mysql - #97
🐛 [BUG][Postgres][Migrations] Fails for text('').array() - #782

0.19.1

17 Jun 09:21
edfae9e
Compare
Choose a tag to compare

🐛 Fix default value generating [Object object] by replacing legacy instanceof checks with is()
🐛 Remove old db connection options from Config type

0.19.9

19 Jul 17:44
edfae9e
Compare
Choose a tag to compare

The new command push:pg is available 🎉

You can now use the push feature with the PostgreSQL databases

Note: The push command is not the same as applying generated migrations. The push command is used for local development to sync your database schema with code without generating extra files. You can read more about it here

New config option schemaFilter 🎉

For PostgreSQL introspect and push, we are introducing a new config option called schemaFilter, which accepts a list of schemas to use for pushing or introspecting the database schema into the code. By default, drizzle-kit will use only the public schema. For more information, please check the documentation

Note: We have a few limitations for PostgreSQL schema usage, described here. It's a priority for us to fix them in the next releases

Usage

{
    schemaFilter: ["custom_schema", "public"]
}

0.19.0

17 Jun 06:58
febd37e
Compare
Choose a tag to compare

Drizzle Kit 0.19.0

Breaking changes

drizzle.config.* file now have a different structure for defining database connection and driver to use. For more about all changes check New Features section

Previously

export default {
  schema: "./schema.ts",
  out: "./drizzle",
  connectionString: '',
} satisfies Config;

Now

import { Config } from "drizzle-kit";

export default {
  schema: "./schema.ts",
  out: "./drizzle",
  driver: "mysql2",
  dbCredentials: {
    connectionString: ''
  },
} satisfies Config;

New Features

ESM support for drizzle-kit 🎉

Drizzle Kit can now be used in both ESM and CommonJS environments.

Config file changes 🎉

  1. New parameter driver allows you to choose the driver with which you want to execute introspect and push statements to the database

Usage

{
  driver: "mysql2", // 'pg' | 'mysql2' | 'better-sqlite' | 'libsql' | 'turso'
  dbCredentials: {
    // Driver specific connection values
  },
}
  1. New parameters verbose and strict have been added for the drizzle-kit push commands.

verbose is responsible for printing all statements that the push command will execute.
strict will always ask for your approval before pushing a schema, even if those statements do not pose a risk of data loss

Usage

{
    verbose: true,
    strict: true
}
  1. New parameter introspect.casing has been introduced to allow you to choose a strategy for the drizzle-kit introspect command when creating JS object keys from database column names

Usage

{
    introspect: {
        casing: 'preserve' // 'camel' | 'preserve'. Default: 'camel'
    }
}

New command drizzle-kit introspect:sqlite 🎉

You can create a database schema from an existing SQLite database by running drizzle-kit introspect:sqlite. This command will generate a schema.ts file and the initial migration for your database.

Config file for introspect

export default {
  out: "./drizzle",
  driver: "turso",
  dbCredentials: {
    url: '',
    authToken: ''
  },
  introspect: {
    casing: 'camel', // optional
  }
} satisfies Config;

New command drizzle-kit push:sqlite 🎉

You can now prototype your schema even faster, without the need of creating migration files each time you need to check the new database structure for a new feature in your app. You can simply run drizzle-kit push:sqlite and your schema will be synced with a database.

You can even run those on a Turso Database directly

Config file for introspect

export default {
  schema: "./schema.ts",
  driver: "turso",
  dbCredentials: {
    url: '',
    authToken: ''
  },
  verbose: true,
  strict: true,
} satisfies Config;

To obtain more information about the SQLite push command, you can refer to a blog post that features the Turso + Drizzle push flow.

Bug fixes

  1. Move check:mysql back to available commands
  2. Add proper error messages and checks for cli+config collisions
  3. Fix drizzle-kit drop command with 0 entries in journal error
  4. Add error if database was not specified for mysql connection
  5. Add tableFilters support to introspect:pg, introspect:mysql, introspect:sqlite. Closing #70
  6. Fix PostgreSQL: generated ALTER TABLE incorrectly adds schema on rename
  7. Fix Error while pushing changes
  8. Fix Typescript and ESM not working together
  9. Fix Cannot find module "drizzle-orm/version"
  10. Fix PG Migrations using Schemas
  11. Fix Cannot use import statement outside a module when using a TypeScript config file
  12. Add support for Feature request: option to match generated column name case to db column name
  13. Fix Generate:mysql command produces a migration file name with a directory separator
  14. Fix Postgres Enums not double quoted when used

0.18.1

25 May 20:44
febd37e
Compare
Choose a tag to compare

Bug fixes

  1. [bug + fix] - Wrong casing for date fields with MySQL #46 - thanks @machour!
  2. MySQL migration produce statements in the wrong order #45 - thanks @JesusTheHun
  3. Issue with dropping a table that contains upper case letters in the name #43
  4. ALTER TABLE and CREATE INDEX statements do not add schema to table name #40
  5. Typo in generated migrations script comment #38 - thanks @andreterron
  6. Migrations pgSchema not respect the schema name after initial migration #34
  7. CLI feedback could be better when a required argument is missing #25
  8. introspect:pg ends with process.exit(1) #63 - thanks @Pr0gramWizard
  9. introspect:pg does not have a --config option #61
  10. [BUG]: push:mysql trying to truncate table with boolean #59
  11. Nothing happens when changing just onUpdate and onDelete for MySQL reference #56
  12. [BUG]: References across schemas does not include schema name in generated migrations 440
  13. [BUG]: postgresql migrations generation: the schema is ignored for indexes (indexes applied to "public" schema) 413
  14. [BUG]: MySQL alter table fails where tablename is reserved word 364
  15. Not picking up primary keys from supabase? #65
  16. --out parameter is required for introspect even though docs say it's not #66

0.18.0

19 May 22:56
febd37e
Compare
Choose a tag to compare

[email protected] 🎉🎉🎉

New features 🎉

New ways to define drizzle config file

You can now specify the configuration not only in the .json format but also in .ts and .js formats.


TypeScript example

import { Config } from "src";

export default {
  schema: "",
  connectionString: process.env.DB_URL,
  out: "",
  breakpoints: true
} satisfies Config;

JavaScript example

/** @type { import("drizzle-kit").Config } */
export default {
    schema: "",
  connectionString: "",
  out: "",
  breakpoints: true
};

New commands 🎉

drizzle-kit push:mysql

You can now push your MySQL schema directly to the database without the need to create and manage migration files. This feature proves to be particularly useful for rapid local development and when working with PlanetScale databases.

By pushing the MySQL schema directly to the database, you can streamline the development process and avoid the overhead of managing migration files. This allows for more efficient iteration and quick deployment of schema changes during local development.

How to setup your codebase for drizzle-kit push feature?

  1. For this feature, you need to create a drizzle.config.[ts|js|json] file. We recommend using .ts or .js files as they allow you to easily provide the database connection information as secret variables

    You'll need to specify schema and connectionString(or db, port, host, password, etc.) to make drizzle-kit push:mysql work

drizzle.config.ts example

import { Config } from "src";

export default {
  schema: "./schema.ts",
  connectionString: process.env.DB_URL,
} satisfies Config;
  1. Run drizzle-kit push:mysql

  2. If Drizzle detects any potential data-loss issues during a migration, it will prompt you to approve whether the data should be truncated or not in order to ensure a successful migration

  3. Approve or reject the action that Drizzle needs to perform in order to push your schema changes to the database.

  4. Done ✅

0.17.6

23 Apr 16:49
263732f
Compare
Choose a tag to compare

🐛 Fixed imports from 0.25.0 drizzle-orm release

Warning: If you are using >= [email protected] please upgrade drizzle-kit to >=0.17.6

0.17.5

18 Apr 13:54
263732f
Compare
Choose a tag to compare

Bugs fixed 🐛

  • "Cannot alter table by adding a primary key" -> #35

0.17.4

04 Apr 11:19
bf80f6d
Compare
Choose a tag to compare
  • 🐛 Fix few bugs in statements escape characters for PostgreSQL and SQLite #19 #16
  • 🐛 Fix composite keys introspect for PostgreSQL bug #12 - thanks @ridem
  • 🐛 Fix "ReferenceError: datetime is not defined" for MySQL introspect feature #27

0.17.3

03 Apr 19:06
bf80f6d
Compare
Choose a tag to compare

Few bug fixes

  • drizzle up command caused empty entries in journal even if there were nothing to upgrade
  • Add escape characters for all MySQL statements