Skip to content

Releases: drizzle-team/drizzle-kit-mirror

0.19.10

20 Jul 18:12
edfae9e
Compare
Choose a tag to compare

Drizzle Studio updates

  • 🎉 Drizzle Studio now has the possibility to export the whole table or selected rows to a json or csv
Screenshot 2023-07-20 at 21 01 23

0.19.8

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

Drizzle Kit

Bug fixes

  • 🐛 Cannot read properties of undefined (reading 'columns') on push:mysql with tableFilters

Drizzle Studio

Bug fixes

Features

  • 🎉 Added a new shortcuts option. You can now navigate, close, and open specific tables using shortcuts
image image

0.19.7

17 Jul 18:09
edfae9e
Compare
Choose a tag to compare

A few more important bug fixes for MySQL:

  • 🐛 Adding NOT NULL and DEFAULT 0 for integer columns was triggering table truncation on push. I asked drizzle-kit not to do it, and he agreed.

  • 🐛 __drizzle_migrations was used for primary key detection during introspection. For now, we will simply filter this table during the information schema querying step.

  • 🐛 Another attempt to fix Impossible to push schema changes due to ER_DROP_INDEX_FK. When pushing and introspecting on MySQL, drizzle-kit was taking all indexes from a database. However, it appears that MySQL automatically creates an index for foreign keys (https://dev.mysql.com/doc/refman/8.0/en/constraint-foreign-key.html)
    As long as you, as a user, do not specify this index in the schema, drizzle-kit will be triggered by changes and attempt to drop index. In this patch release, we have decided to ignore such indexes and add collision checks for the same name of foreign key constraints and indexes in the same table.

  • 🐛 MySQL defaults with sql inside were mapped incorrectly, which caused constant schema changes during push. We have made changes to the way generated defaults are handled in the code, so now it should work properly.

  • ✍️ Added a new collision check between indexes and foreign key constraints with the same name in the same table. Finally, drizzle-kit's collision checks are expanding. We have included some documentation and blog post links for anyone interested in understanding how databases work for specific cases

0.19.6

16 Jul 19:18
edfae9e
Compare
Choose a tag to compare

n this issue, there were two problems with MySQL migration generation and schema pushing:

  1. MySQL, like SQLite, does not have a difference in unique constraints and unique indexes at the database level. This aspect was handled correctly for SQLite but not for MySQL. In MySQL, when a unique index is created from a Drizzle schema, it is stored as both a unique constraint and a unique index in the database. Therefore, there was no distinction between the two. This led to incorrect assumptions during schema pushes regarding the creation, dropping, or storage of unique indexes. In the current fixes, Drizzle Kit now treats unique constraints as unique indexes for MySQL and SQLite only.

  2. Drizzle Kit was attempting to drop the primary key when it shouldn't have done so. The issue was with incorrect querying of the information schema. Drizzle Kit was examining the column definition and the column_key setting from the information_schema.columns table. However, it turns out that the column_key value can indicate PRIMARY even for columns that are both UNIQUE and NOT_NULL. Which is correct in database terms, but not valid in the determination if this constraint was created as Primary Key.

I have made changes to address this problem by utilizing the information_schema.table_constraints table, which provides a proper distinction between primary keys and columns with the combination of UNIQUE and NOT_NULL

  • ✍️ Added new collision check between the same names in unique indexes and unique constraints in schema(for MySQL)

0.19.5

12 Jul 20:25
edfae9e
Compare
Choose a tag to compare

0.19.4

11 Jul 22:10
edfae9e
Compare
Choose a tag to compare

🎉 Added support for UNIQUE constraints in PostgreSQL, MySQL, SQLite

Drizzle Kit now properly handles unique constraints for each dialect. In PostgreSQL and MySQL, they will be created as UNIQUE constraints, while in SQLite, they will be created as UNIQUE INDEX statements. According to the SQLite documentation, unique constraints are treated as unique indexes. Therefore, in the ORM and Kit, we handle unique constraints for SQLite as unique indexes

🎉 Collision detection for unique keys

We are introducing collision detection for unique keys as part of the new wave of drizzle-kit improvements. Currently, if drizzle-kit finds any unique constraints with the same name, you will receive a warning and identify the places where those names were defined by mistake. In the upcoming releases, we will further enhance this feature by adding collision checks for column names, other constraints, and more collisions and database-specific limitations.

image

0.19.3

01 Jul 18:28
edfae9e
Compare
Choose a tag to compare

Drizzle Studio

New cli command is available drizzle-kit studio

Drizzle Studio is a helper for data visualization. It seamlessly integrates with your existing data infrastructure by reading the drizzle.config file and establishing a connection to your specified database. Studio supports all drivers, including pg, mysql2, better-sqlite, libsql, and even turso driver!

Available actions

  1. Retrieve a list of all tables in the schema.
  2. Obtain the row count for each table.
  3. Perform table selection with options such as limit, offset, filters, and partial select.
  4. View all relations defined by the Relational Queries utility.
  5. Create, update, and delete entities from tables.
  6. Benefit from basic type validation.

Available cli options

  1. --port=3000 - By default, Drizzle will use port 4983, but you can specify any port you desire
  2. --verbose - With this flag, you can print all statements that Drizzle Studio will execute while you browse through your data

For more information please check: https://driz.li/meet-studio

Improvements Roadmap

  1. Enhance validations with helpers such as datepicker, JSON validation, and more.
  2. Expand the range of filter options available.
  3. Introduce a schema change listener.
  4. And much more!

Bug fixes

  1. Correct the wrong typing option for SQLite generate and push commands when using autoincrement.
  2. Address the SQLite push issue that generates incorrect defaults for booleans.
  3. Resolve the SQLite push issue where unnecessary migrations are generated for composite primary keys.

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"]
}