npm drizzle-kit 0.19.6

latest releases: 0.25.0-d1da3b8, 0.25.0-ff1e9a5, 0.25.0-8dece56...
14 months ago

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)

Don't miss a new drizzle-kit release

NewReleases is sending notifications on new releases.