Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency drizzle-orm to ^0.38.0 #156

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 3, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
drizzle-orm (source) ^0.36.0 -> ^0.38.0 age adoption passing confidence

Release Notes

drizzle-team/drizzle-orm (drizzle-orm)

v0.38.0

Compare Source

Types breaking changes

A few internal types were changed and extra generic types for length of column types were added in this release. It won't affect anyone, unless you are using those internal types for some custom wrappers, logic, etc. Here is a list of all types that were changed, so if you are relying on those, please review them before upgrading

  • MySqlCharBuilderInitial
  • MySqlVarCharBuilderInitial
  • PgCharBuilderInitial
  • PgArrayBuilder
  • PgArray
  • PgVarcharBuilderInitial
  • PgBinaryVectorBuilderInitial
  • PgBinaryVectorBuilder
  • PgBinaryVector
  • PgHalfVectorBuilderInitial
  • PgHalfVectorBuilder
  • PgHalfVector
  • PgVectorBuilderInitial
  • PgVectorBuilder
  • PgVector
  • SQLiteTextBuilderInitial

New Features

  • Added new function getViewSelectedFields
  • Added $inferSelect function to views
  • Added InferSelectViewModel type for views
  • Added isView function

Validator packages updates

  • drizzle-zod has been completely rewritten. You can find detailed information about it here
  • drizzle-valibot has been completely rewritten. You can find detailed information about it here
  • drizzle-typebox has been completely rewritten. You can find detailed information about it here

Thanks to @​L-Mario564 for making more updates than we expected to be shipped in this release. We'll copy his message from a PR regarding improvements made in this release:

  • Output for all packages are now unminified, makes exploring the compiled code easier when published to npm.
  • Smaller footprint. Previously, we imported the column types at runtime for each dialect, meaning that for example, if you're just using Postgres then you'd likely only have drizzle-orm and drizzle-orm/pg-core in the build output of your app; however, these packages imported all dialects which could lead to mysql-core and sqlite-core being bundled as well even if they're unused in your app. This is now fixed.
  • Slight performance gain. To determine the column data type we used the is function which performs a few checks to ensure the column data type matches. This was slow, as these checks would pile up every quickly when comparing all data types for many fields in a table/view. The easier and faster alternative is to simply go off of the column's columnType property.
  • Some changes had to be made at the type level in the ORM package for better compatibility with drizzle-valibot.

And a set of new features

  • createSelectSchema function now also accepts views and enums.
  • New function: createUpdateSchema, for use in updating queries.
  • New function: createSchemaFactory, to provide more advanced options and to avoid bloating the parameters of the other schema functions

Bug fixes

v0.37.0

Compare Source

New Dialects

🎉 SingleStore dialect is now available in Drizzle

Thanks to the SingleStore team for creating a PR with all the necessary changes to support the MySQL-compatible part of SingleStore. You can already start using it with Drizzle. The SingleStore team will also help us iterate through updates and make more SingleStore-specific features available in Drizzle

import { int, singlestoreTable, varchar } from 'drizzle-orm/singlestore-core';
import { drizzle } from 'drizzle-orm/singlestore';

export const usersTable = singlestoreTable('users_table', {
  id: int().primaryKey(),
  name: varchar({ length: 255 }).notNull(),
  age: int().notNull(),
  email: varchar({ length: 255 }).notNull().unique(),
});

...

const db = drizzle(process.env.DATABASE_URL!);

db.select()...

You can check out our Getting started guides to try SingleStore!

New Drivers

🎉 SQLite Durable Objects driver is now available in Drizzle

You can now query SQLite Durable Objects in Drizzle!

For the full example, please check our Get Started Section

/// <reference types="@&#8203;cloudflare/workers-types" />
import { drizzle, DrizzleSqliteDODatabase } from 'drizzle-orm/durable-sqlite';
import { DurableObject } from 'cloudflare:workers'
import { migrate } from 'drizzle-orm/durable-sqlite/migrator';
import migrations from '../drizzle/migrations';
import { usersTable } from './db/schema';

export class MyDurableObject1 extends DurableObject {
  storage: DurableObjectStorage;
  db: DrizzleSqliteDODatabase<any>;

  constructor(ctx: DurableObjectState, env: Env) {
    super(ctx, env);
    this.storage = ctx.storage;
    this.db = drizzle(this.storage, { logger: false });
  }

    async migrate() {
        migrate(this.db, migrations);
    }

  async insert(user: typeof usersTable.$inferInsert) {
        await this.db.insert(usersTable).values(user);
    }

  async select() {
        return this.db.select().from(usersTable);
    }
}

export default {
  /**
   * This is the standard fetch handler for a Cloudflare Worker
   *
   * @&#8203;param request - The request submitted to the Worker from the client
   * @&#8203;param env - The interface to reference bindings declared in wrangler.toml
   * @&#8203;param ctx - The execution context of the Worker
   * @&#8203;returns The response to be sent back to the client
   */
  async fetch(request: Request, env: Env): Promise<Response> {
    const id: DurableObjectId = env.MY_DURABLE_OBJECT1.idFromName('durable-object');
    const stub = env.MY_DURABLE_OBJECT1.get(id);
    await stub.migrate();

    await stub.insert({
      name: 'John',
      age: 30,
      email: '[email protected]',
      })
    console.log('New user created!')
  
    const users = await stub.select();
    console.log('Getting all users from the database: ', users)

        return new Response();
    }
}

Bug fixes


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Copy link

vercel bot commented Dec 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
homelab-connector ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 9, 2024 5:34pm

@renovate renovate bot changed the title fix(deps): update dependency drizzle-orm to ^0.37.0 fix(deps): update dependency drizzle-orm to ^0.38.0 Dec 9, 2024
@renovate renovate bot force-pushed the renovate/drizzle-orm-0.x branch from fc831c3 to ffa3765 Compare December 9, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Something isn't working patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants