Releases: drizzle-team/drizzle-kit-mirror
0.19.2
😢 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
🐛 Fix default value generating [Object object] by replacing legacy instanceof
checks with is()
🐛 Remove old db connection options from Config type
0.19.9
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. Thepush
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
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 🎉
- New parameter
driver
allows you to choose the driver with which you want to executeintrospect
andpush
statements to the database
Usage
{
driver: "mysql2", // 'pg' | 'mysql2' | 'better-sqlite' | 'libsql' | 'turso'
dbCredentials: {
// Driver specific connection values
},
}
- New parameters
verbose
andstrict
have been added for thedrizzle-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
}
- New parameter
introspect.casing
has been introduced to allow you to choose a strategy for thedrizzle-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
- Move
check:mysql
back to available commands - Add proper error messages and checks for cli+config collisions
- Fix
drizzle-kit drop
command with 0 entries in journal error - Add error if database was not specified for mysql connection
- Add
tableFilters
support tointrospect:pg
,introspect:mysql
,introspect:sqlite
. Closing #70 - Fix PostgreSQL: generated ALTER TABLE incorrectly adds schema on rename
- Fix Error while pushing changes
- Fix Typescript and ESM not working together
- Fix Cannot find module "drizzle-orm/version"
- Fix PG Migrations using Schemas
- Fix Cannot use import statement outside a module when using a TypeScript config file
- Add support for Feature request: option to match generated column name case to db column name
- Fix Generate:mysql command produces a migration file name with a directory separator
- Fix Postgres Enums not double quoted when used
0.18.1
Bug fixes
- [bug + fix] - Wrong casing for date fields with MySQL #46 - thanks @machour!
- MySQL migration produce statements in the wrong order #45 - thanks @JesusTheHun
- Issue with dropping a table that contains upper case letters in the name #43
- ALTER TABLE and CREATE INDEX statements do not add schema to table name #40
- Typo in generated migrations script comment #38 - thanks @andreterron
- Migrations pgSchema not respect the schema name after initial migration #34
- CLI feedback could be better when a required argument is missing #25
- introspect:pg ends with process.exit(1) #63 - thanks @Pr0gramWizard
- introspect:pg does not have a --config option #61
- [BUG]: push:mysql trying to truncate table with boolean #59
- Nothing happens when changing just onUpdate and onDelete for MySQL reference #56
- [BUG]: References across schemas does not include schema name in generated migrations 440
- [BUG]: postgresql migrations generation: the schema is ignored for indexes (indexes applied to "public" schema) 413
- [BUG]: MySQL alter table fails where tablename is reserved word 364
- Not picking up primary keys from supabase? #65
- --out parameter is required for introspect even though docs say it's not #66
0.18.0
[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?
-
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 variablesYou'll need to specify
schema
andconnectionString
(ordb
,port
,host
,password
, etc.) to makedrizzle-kit push:mysql
work
drizzle.config.ts
example
import { Config } from "src";
export default {
schema: "./schema.ts",
connectionString: process.env.DB_URL,
} satisfies Config;
-
Run
drizzle-kit push:mysql
-
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 -
Approve or reject the action that Drizzle needs to perform in order to push your schema changes to the database.
-
Done ✅
0.17.6
🐛 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
Bugs fixed 🐛
- "Cannot alter table by adding a primary key" -> #35
0.17.4
0.17.3
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