Skip to content

Releases: drizzle-team/drizzle-orm

0.23.9

09 Apr 17:44
18c4a34
Compare
Choose a tag to compare

Transactions support 🎉

You can now use transactions with all the supported databases and drivers.

node-postgres example:

await db.transaction(async (tx) => {
  await tx.insert(users).values(newUser);
  await tx.update(users).set({ name: 'Mr. Dan' }).where(eq(users.name, 'Dan'));
  await tx.delete(users).where(eq(users.name, 'Dan'));
});

For more information, see transactions docs:

0.23.8

06 Apr 11:38
3697122
Compare
Choose a tag to compare
  • 🐛 Fixed dates timezone differences for timestamps in Postgres and MySQL (contributed by @AppelBoomHD via #288)

0.23.7

06 Apr 11:15
6be3fa3
Compare
Choose a tag to compare
  • 🎉 Added INSERT IGNORE support for MySQL (contributed by @FugiTech via #305)

0.23.6

05 Apr 11:17
26ec506
Compare
Choose a tag to compare
  • 🐛 Fixed referencing the selected aliased field in the same query
  • 🐛 Fixed decimal column data type in MySQL
  • 🐛 Fixed mode autocompletion for integer column in SQLite
  • 🐛 Fixed extra parentheses in the generated SQL for the IN operator (#382)
  • 🐛 Fixed regression in pgEnum.enumValues type (#358)
  • 🎉 Allowed readonly arrays to be passed to pgEnum

0.23.5

03 Apr 17:44
5c6c4cd
Compare
Choose a tag to compare
  • 🐛 Various minor bugfixes

0.23.4

01 Apr 00:50
3d307b2
Compare
Choose a tag to compare
  • 🐛 Fixed broken types in Kysely and Knex adapters

0.23.3

31 Mar 23:38
0437a5c
Compare
Choose a tag to compare

0.23.2

27 Mar 11:39
88be5f8
Compare
Choose a tag to compare
  • 🐛 Rolled back some breaking changes for drizzle-kit

0.23.1

26 Mar 22:31
b2d5f81
Compare
Choose a tag to compare
  • 🐛 Re-export InferModel from drizzle-orm

0.23.0

26 Mar 22:12
fa27960
Compare
Choose a tag to compare
  • 🎉 Added Knex and Kysely adapters! They allow you to manage the schemas and migrations with Drizzle and query the data with your favorite query builder. See documentation for more details:

  • 🎉 Added "type maps" to all entities. You can access them via the special _ property. For example:

    const users = mysqlTable('users', {
      id: int('id').primaryKey(),
      name: text('name').notNull(),
    });
    
    type UserFields = typeof users['_']['columns'];
    type InsertUser = typeof users['_']['model']['insert'];

    Full documentation on the type maps is coming soon.

  • 🎉 Added .$type() method to all column builders to allow overriding the data type. It also replaces the optional generics on columns.

    // Before
    const test = mysqlTable('test', {
      jsonField: json<Data>('json_field'),
    });
    
    // After
    const test = mysqlTable('test', {
      jsonField: json('json_field').$type<Data>(),
    });
  • ❗ Changed syntax for text-based enum columns:

    // Before
    const test = mysqlTable('test', {
      role: text<'admin' | 'user'>('role'),
    });
    
    // After
    const test = mysqlTable('test', {
      role: text('role', { enum: ['admin', 'user'] }),
    });
  • 🎉 Allowed passing an array of values into .insert().values() directly without spreading:

    const users = mysqlTable('users', {
      id: int('id').primaryKey(),
      name: text('name').notNull(),
    });
    
    await users.insert().values([
      { name: 'John' },
      { name: 'Jane' },
    ]);

    The spread syntax is now deprecated and will be removed in one of the next releases.

  • 🎉 Added "table creators" to allow for table name customization:

    import { mysqlTableCreator } from 'drizzle-orm/mysql-core';
    
    const mysqlTable = mysqlTableCreator((name) => `myprefix_${name}`);
    
    const users = mysqlTable('users', {
      id: int('id').primaryKey(),
      name: text('name').notNull(),
    });
    
    // Users table is a normal table, but its name is `myprefix_users` in runtime
  • 🎉 Implemented support for selecting/joining raw SQL expressions:

    // select current_date + s.a as dates from generate_series(0,14,7) as s(a);
    const result = await db
      .select({
        dates: sql`current_date + s.a`,
      })
      .from(sql`generate_series(0,14,7) as s(a)`);
  • 🐛 Fixed a lot of bugs from user feedback on GitHub and Discord (thank you! ❤). Fixes #293 #301 #276 #269 #253 #311 #312