also looking at this
chore(deps): update all non-major dependencies
#123This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence | Type | Update |
|---|---|---|---|---|---|---|---|
| @prisma/client (source) | ^6.16.3 -> ^6.17.0 | dependencies | minor | ||||
| @types/bun (source) | ^1.2.21 -> ^1.2.23 | devDependencies | patch | ||||
| actions/cache | v4.2.4 -> v4.3.0 | action | minor | ||||
| bun-git-hooks | ^0.2.19 -> ^0.3.1 | devDependencies | minor | ||||
| chalk | ^5.3.0 -> ^5.6.2 | dependencies | minor | ||||
| drizzle-orm (source) | ^0.36.4 -> ^0.44.6 | dependencies | minor | ||||
| prisma (source) | ^6.16.3 -> ^6.17.0 | dependencies | minor | ||||
| shivammathur/setup-php | 2.35.4 -> 2.35.5 | action | patch | ||||
| typescript (source) | ^5.9.2 -> ^5.9.3 | devDependencies | patch |
Release Notes
prisma/prisma (@​prisma/client)
v6.17.0
Today, we are excited to share the 6.17.0 stable release 🎉
🌟 Star this repo for notifications about new releases, bug fixes & features — or follow us on X!
Prisma ORM
Prisma ORM is the most popular ORM in the TypeScript ecosystem. Today's release brings a number of bug fixes and improvements to Prisma ORM.
Bug fixes and improvements
- Added support for Entra ID (ActiveDirectory) authentication parameters for the MS SQL Server driver adapter. For example, you can use the
configobject to configure DefaultAzureCredential:
Learn more in this PR.import { PrismaMssql } from '@​prisma/adapter-mssql' import { PrismaClient } from '@​prisma/client' const config = { server: 'localhost', port: 1433, database: 'mydb', authentication: { type: 'azure-active-directory-default', }, options: { encrypt: true, }, } const adapter = new PrismaMssql(config) const prisma = new PrismaClient({ adapter }) - Relaxed the support package range for
@opentelemetry/instrumentationto be compatible with">=0.52.0 <1". Learn more in this PR. - Added Codex CLI detection, ensuring dangerous Prisma operations are not executed by Codex without explicit user consent. Learn more in this PR.
- Fixed JSON column handling when using a MariaDB database. Learn more in this PR.
- Restored the original behaviour of group-by aggregations where they would refer to columns with explicit table names which fixes a regression that would result in ambiguous column errors. Learn more in this PR.
Enterprise support
Thousands of teams use Prisma and many of them already tap into our Enterprise & Agency Support Program for hands-on help with everything from schema integrations and performance tuning to security and compliance.
With this program you also get priority issue triage and bug fixes, expert scalability advice, and custom training so that your Prisma-powered apps stay rock-solid at any scale. Learn more or join: https://prisma.io/enterprise.
actions/cache (actions/cache)
v4.3.0
What's Changed
- Add note on runner versions by @GhadimiR in #1642
- Prepare
v4.3.0release by @Link- in #1655
New Contributors
- @GhadimiR made their first contribution in #1642
Full Changelog: https://github.com/actions/cache/compare/v4...v4.3.0
stacksjs/bun-git-hooks (bun-git-hooks)
v0.3.1
No significant changes
View changes on GitHub
v0.3.0
No significant changes
View changes on GitHub
chalk/chalk (chalk)
v5.6.2
- Fix vulnerability in 5.6.1, see: #656
v5.6.0
- Make WezTerm terminal use true color
a8f5bf7
v5.5.0
v5.4.1
v5.4.0
- Update
CIRCLECIenvironments to return level 3 color supportf838120
drizzle-team/drizzle-orm (drizzle-orm)
v0.44.6
- feat: add $replicas reference #4874
v0.44.5
- Fixed invalid usage of
.one()indurable-sqlitesession - Fixed spread operator related crash in sqlite
blobcolumns - Better browser support for sqlite
blobcolumns - Improved sqlite
blobmapping
v0.44.4
- Fix wrong DrizzleQueryError export. thanks @nathankleyn
v0.44.3
- Fixed types of
$clientfor clients created by drizzle function
await db.$client.[...]- Added the
updated_atcolumn to theneon_auth.users_synctable definition.
v0.44.2
v0.44.1
v0.44.0
Error handling
Starting from this version, we’ve introduced a new DrizzleQueryError that wraps all errors from database drivers and provides a set of useful information:
- A proper stack trace to identify which exact
Drizzlequery failed - The generated SQL string and its parameters
- The original stack trace from the driver that caused the DrizzleQueryError
Drizzle cache module
Drizzle sends every query straight to your database by default. There are no hidden actions, no automatic caching or invalidation - you’ll always see exactly what runs. If you want caching, you must opt in.
By default, Drizzle uses a explicit caching strategy (i.e. global: false), so nothing is ever cached unless you ask. This prevents surprises or hidden performance traps in your application. Alternatively, you can flip on all caching (global: true) so that every select will look in cache first.
Out first native integration was built together with Upstash team and let you natively use upstash as a cache for your drizzle queries
import { upstashCache } from "drizzle-orm/cache/upstash";
import { drizzle } from "drizzle-orm/...";
const db = drizzle(process.env.DB_URL!, {
cache: upstashCache({
// 👇 Redis credentials (optional — can also be pulled from env vars)
url: '<UPSTASH_URL>',
token: '<UPSTASH_TOKEN>',
// 👇 Enable caching for all queries by default (optional)
global: true,
// 👇 Default cache behavior (optional)
config: { ex: 60 }
})
});You can also implement your own cache, as Drizzle exposes all the necessary APIs, such as get, put, mutate, etc. You can find full implementation details on the website
import Keyv from "keyv";
export class TestGlobalCache extends Cache {
private globalTtl: number = 1000;
// This object will be used to store which query keys were used
// for a specific table, so we can later use it for invalidation.
private usedTablesPerKey: Record<string, string[]> = {};
constructor(private kv: Keyv = new Keyv()) {
super();
}
// For the strategy, we have two options:
// - 'explicit': The cache is used only when .$withCache() is added to a query.
// - 'all': All queries are cached globally.
// The default behavior is 'explicit'.
override strategy(): "explicit" | "all" {
return "all";
}
// This function accepts query and parameters that cached into key param,
// allowing you to retrieve response values for this query from the cache.
override async get(key: string): Promise<any[] | undefined> {
...
}
// This function accepts several options to define how cached data will be stored:
// - 'key': A hashed query and parameters.
// - 'response': An array of values returned by Drizzle from the database.
// - 'tables': An array of tables involved in the select queries. This information is needed for cache invalidation.
//
// For example, if a query uses the "users" and "posts" tables, you can store this information. Later, when the app executes
// any mutation statements on these tables, you can remove the corresponding key from the cache.
// If you're okay with eventual consistency for your queries, you can skip this option.
override async put(
key: string,
response: any,
tables: string[],
config?: CacheConfig,
): Promise<void> {
...
}
// This function is called when insert, update, or delete statements are executed.
// You can either skip this step or invalidate queries that used the affected tables.
//
// The function receives an object with two keys:
// - 'tags': Used for queries labeled with a specific tag, allowing you to invalidate by that tag.
// - 'tables': The actual tables affected by the insert, update, or delete statements,
// helping you track which tables have changed since the last cache update.
override async onMutate(params: {
tags: string | string[];
tables: string | string[] | Table<any> | Table<any>[];
}): Promise<void> {
...
}
}For more usage example you can check our docs
v0.43.1
Fixes
v0.43.0
Features
- Added
cross join(#1414) - Added lateral
left,inner,crossjoins toPostgreSQL,MySQL,Gel,SingleStore - Added drizzle connection attributes to
SingleStore's driver instances
Fixes
- Removed unsupported by dialect
full joinfromMySQLselect api - Forced
Gelcolumns to always have explicit schema & table prefixes due to potential errors caused by lack of such prefix in subquery's selection when there's already a column bearing same name in context - Added missing export for
PgTextBuilderInitialtype - Removed outdated
IfNotImportedtype check fromSingleStoredriver initializer - Fixed incorrect type inferrence for insert and update models with non-strict
tsconfigs (#2654) - Fixed invalid spelling of
nowaitflag (#3554) - Add join lateral support
- Remove .fullJoin() from MySQL API
v0.42.0
Features
Duplicate imports removal
When importing from drizzle-orm using custom loaders, you may encounter issues such as: SyntaxError: The requested module 'drizzle-orm' does not provide an export named 'eq'
This issue arose because there were duplicated exports in drizzle-orm. To address this, we added a set of tests that checks every file in drizzle-orm to ensure all exports are valid. These tests will fail if any new duplicated exports appear.
In this release, we’ve removed all duplicated exports, so you should no longer encounter this issue.
pgEnum and mysqlEnum now can accept both strings and TS enums
If you provide a TypeScript enum, all your types will be inferred as that enum - so you can insert and retrieve enum values directly. If you provide a string union, it will work as before.
enum Test {
a = 'a',
b = 'b',
c = 'c',
}
const tableWithTsEnums = mysqlTable('enums_test_case', {
id: serial().primaryKey(),
enum1: mysqlEnum(Test).notNull(),
enum2: mysqlEnum(Test).default(Test.a),
});
await db.insert(tableWithTsEnums).values([
{ id: 1, enum1: Test.a, enum2: Test.b, enum3: Test.c },
{ id: 2, enum1: Test.a, enum3: Test.c },
{ id: 3, enum1: Test.a },
]);
const res = await db.select().from(tableWithTsEnums);
expect(res).toEqual([
{ id: 1, enum1: 'a', enum2: 'b', enum3: 'c' },
{ id: 2, enum1: 'a', enum2: 'a', enum3: 'c' },
{ id: 3, enum1: 'a', enum2: 'a', enum3: 'b' },
]);Improvements
- Make
inArrayacceptReadonlyArrayas a value - thanks @Zamiell - Pass row type parameter to
@planetscale/database's execute - thanks @ayrton - New
InferEnumtype - thanks @totigm
Issues closed
- Add first-class support for TS native enums
- [FEATURE]: support const enums
- [BUG]: SyntaxError: The requested module 'drizzle-orm' does not provide an export named 'lte'
v0.41.0
bigint,numbermodes forSQLite,MySQL,PostgreSQL,SingleStoredecimal&numericcolumn types- Changed behavior of
sql-jsquery preparation to query prebuild instead of db-side prepare due to need to manually free prepared queries, removed.free()method - Fixed
MySQL,SingleStorevarcharallowing not specifyinglengthin config - Fixed
MySQL,SingleStorebinary,varbinarydata\type mismatches - Fixed
numeric\decimaldata\type mismatches: #1290, #1453 - Fixed
drizzle-studio+AWS Data Apiconnection issue: #3224 - Fixed
isConfigutility function checking types of wrong fields - Enabled
supportBigNumbersin auto-createdmysql2driver instances - Fixed custom schema tables querying in RQBv1: #4060
- Removed in-driver mapping for postgres types
1231(numeric[]),1115(timestamp[]),1185(timestamp_with_timezone[]),1187(interval[]),1182(date[]), preventing precision loss and data\type mismatches - Fixed
SQLitebuffer-modeblobsometimes returningnumber[]
v0.40.1
Updates to neon-http for @neondatabase/serverless@1.0.0 - thanks @jawj
Starting from this version, drizzle-orm will be compatible with both @neondatabase/serverless <1.0 and >1.0
v0.40.0
New Features
Added Gel dialect support and gel-js client support
Drizzle is getting a new Gel dialect with its own types and Gel-specific logic. In this first iteration, almost all query-building features have been copied from the PostgreSQL dialect since Gel is fully PostgreSQL-compatible. The only change in this iteration is the data types. The Gel dialect has a different set of available data types, and all mappings for these types have been designed to avoid any extra conversions on Drizzle's side. This means you will insert and select exactly the same data as supported by the Gel protocol.
Drizzle + Gel integration will work only through drizzle-kit pull. Drizzle won't support generate, migrate, or push features in this case. Instead, drizzle-kit is used solely to pull the Drizzle schema from the Gel database, which can then be used in your drizzle-orm queries.
The Gel + Drizzle workflow:
- Use the
gelCLI to manage your schema. - Use the
gelCLI to generate and apply migrations to the database. - Use drizzle-kit to pull the Gel database schema into a Drizzle schema.
- Use drizzle-orm with gel-js to query the Gel database.
Here is a small example of how to connect to Gel using Drizzle:
// Make sure to install the 'gel' package
import { drizzle } from "drizzle-orm/gel";
import { createClient } from "gel";
const gelClient = createClient();
const db = drizzle({ client: gelClient });
const result = await db.execute('select 1');and drizzle-gel schema definition
import { gelTable, uniqueIndex, uuid, smallint, text } from "drizzle-orm/gel-core"
import { sql } from "drizzle-orm"
export const users = gelTable("users", {
id: uuid().default(sql`uuid_generate_v4()`).primaryKey(),
age: smallint(),
email: text().notNull(),
name: text(),
});On the drizzle-kit side you can now use dialect: "gel"
// drizzle.config.ts
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
dialect: 'gel',
});For a complete Get Started tutorial you can use our new guides:
- Get Started with Drizzle and Gel in a new project
- Get Started with Drizzle and Gel in a existing project
v0.39.3
- Remove
reactfrom peerDependencies
v0.39.2
- To be compatible with latest Neon Auth feature we renamed the pre-defined schema internally, from
neon_identitytoneon_auth- thanks @pffigueiredo
v0.39.1
- Fixed SQLite onConflict clauses being overwritten instead of stacked - #2276
- Added view support to
aliasedTable() - Fixed sql builder prefixing aliased views and tables with their schema
v0.39.0
New features
Bun SQL driver support
You can now use the new Bun SQL driver released in Bun v1.2.0 with Drizzle
In version 1.2.0, Bun has issues with executing concurrent statements, which may lead to errors if you try to run several queries simultaneously. We've created a github issue that you can track. Once it's fixed, you should no longer encounter any such errors on Bun's SQL side
import { drizzle } from 'drizzle-orm/bun-sql';
const db = drizzle(process.env.PG_DB_URL!);
const result = await db.select().from(...);or you can use Bun SQL instance
import { drizzle } from 'drizzle-orm/bun-sql';
import { SQL } from 'bun';
const client = new SQL(process.env.PG_DB_URL!);
const db = drizzle({ client });
const result = await db.select().from(...);Current Limitations:
jsonandjsonbinserts and selects currently perform an additionalJSON.stringifyon the Bun SQL side. Once this is removed, they should work properly. You can always use custom types and redefine the mappers to and from the database.datetime,date, andtimestampwill not work properly when usingmode: stringin Drizzle. This is due to Bun's API limitations, which prevent custom parsers for queries. As a result, Drizzle cannot control the response sent from Bun SQL to Drizzle. Once this feature is added to Bun SQL, it should work as expected.arraytypes currently have issues in Bun SQL.
You can check more in Bun docs
You can check more getting started examples in Drizzle docs
WITH now supports INSERT, UPDATE, DELETE and raw sql template
with and insert
const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
});
const sq = db.$with('sq').as(
db.insert(users).values({ name: 'John' }).returning(),
);
const result = await db.with(sq).select().from(sq);with and update
const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
});
const sq = db.$with('sq').as(
db.update(users).set({ age: 25 }).where(eq(users.name, 'John')).returning(),
);
const result = await db.with(sq).select().from(sq);with and delete
const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
});
const sq = db.$with('sq').as(
db.delete(users).where(eq(users.name, 'John')).returning(),
);
const result = await db.with(sq).select().from(sq);with and sql
const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
});
const sq = db.$with('sq', {
userId: users.id,
data: {
name: users.name,
},
}).as(sql`select * from ${users} where ${users.name} = 'John'`);
const result = await db.with(sq).select().from(sq);New tables in /neon import
In this release you can use neon_identity schema and users_sync table inside this schema by just importing it from /neon
// "drizzle-orm/neon"
const neonIdentitySchema = pgSchema('neon_identity');
/**
* Table schema of the `users_sync` table used by Neon Identity.
* This table automatically synchronizes and stores user data from external authentication providers.
*
* @​schema neon_identity
* @​table users_sync
*/
export const usersSync = neonIdentitySchema.table('users_sync', {
rawJson: jsonb('raw_json').notNull(),
id: text().primaryKey().notNull(),
name: text(),
email: text(),
createdAt: timestamp('created_at', { withTimezone: true, mode: 'string' }),
deletedAt: timestamp('deleted_at', { withTimezone: true, mode: 'string' }),
});Utils and small improvements
getViewName util function
import { getViewName } from 'drizzle-orm/sql'
export const user = pgTable("user", {
id: serial(),
name: text(),
email: text(),
});
export const userView = pgView("user_view").as((qb) => qb.select().from(user));
const viewName = getViewName(userView)Bug fixed and GitHub issue closed
- [FEATURE]: allow INSERT in CTEs (WITH clauses)
- [FEATURE]: Support Raw SQL in CTE Query Builder
- [FEATURE]: include pre-defined database objects related to Neon Identity in drizzle-orm
- [BUG]: $count is undefined on withReplicas
- [FEATURE]: get[Materialized]ViewName, ie getTableName but for (materialized) views.
- [BUG]: $count API error with vercel-postgres
- [BUG]: Cannot use schema.coerce on refining drizzle-zod types
- [FEATURE]: Type Coercion in drizzle-zod
- [BUG]: The inferred type of X cannot be named without a reference to ../../../../../node_modules/drizzle-zod/schema.types.internal.mjs
- [BUG]: drizzle-zod excessively deep and possibly infinite types
v0.38.4
- New SingleStore type
vector- thanks @mitchwadair - Fix wrong DROP INDEX statement generation, #3866 - thanks @WaciX
- Typo fixes - thanks @stephan281094
v0.38.3
- Fix incorrect deprecation detection for table declarations
v0.38.2
New features
USE INDEX, FORCE INDEX and IGNORE INDEX for MySQL
In MySQL, the statements USE INDEX, FORCE INDEX, and IGNORE INDEX are hints used in SQL queries to influence how the query optimizer selects indexes. These hints provide fine-grained control over index usage, helping optimize performance when the default behavior of the optimizer is not ideal.
Use Index
The USE INDEX hint suggests to the optimizer which indexes to consider when processing the query. The optimizer is not forced to use these indexes but will prioritize them if they are suitable.
export const users = mysqlTable('users', {
id: int('id').primaryKey(),
name: varchar('name', { length: 100 }).notNull(),
}, () => [usersTableNameIndex]);
const usersTableNameIndex = index('users_name_index').on(users.name);
await db.select()
.from(users, { useIndex: usersTableNameIndex })
.where(eq(users.name, 'David'));Ignore Index
The IGNORE INDEX hint tells the optimizer to avoid using specific indexes for the query. MySQL will consider all other indexes (if any) or perform a full table scan if necessary.
export const users = mysqlTable('users', {
id: int('id').primaryKey(),
name: varchar('name', { length: 100 }).notNull(),
}, () => [usersTableNameIndex]);
const usersTableNameIndex = index('users_name_index').on(users.name);
await db.select()
.from(users, { ignoreIndex: usersTableNameIndex })
.where(eq(users.name, 'David'));Force Index
The FORCE INDEX hint forces the optimizer to use the specified index(es) for the query. If the specified index cannot be used, MySQL will not fall back to other indexes; it might resort to a full table scan instead.
export const users = mysqlTable('users', {
id: int('id').primaryKey(),
name: varchar('name', { length: 100 }).notNull(),
}, () => [usersTableNameIndex]);
const usersTableNameIndex = index('users_name_index').on(users.name);
await db.select()
.from(users, { forceIndex: usersTableNameIndex })
.where(eq(users.name, 'David'));You can also combine those hints and use multiple indexes in a query if you need
v0.38.1
v0.38.0
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
MySqlCharBuilderInitialMySqlVarCharBuilderInitialPgCharBuilderInitialPgArrayBuilderPgArrayPgVarcharBuilderInitialPgBinaryVectorBuilderInitialPgBinaryVectorBuilderPgBinaryVectorPgHalfVectorBuilderInitialPgHalfVectorBuilderPgHalfVectorPgVectorBuilderInitialPgVectorBuilderPgVectorSQLiteTextBuilderInitial
New Features
- Added new function
getViewSelectedFields - Added
$inferSelectfunction to views - Added
InferSelectViewModeltype for views - Added
isViewfunction
Validator packages updates
drizzle-zodhas been completely rewritten. You can find detailed information about it heredrizzle-valibothas been completely rewritten. You can find detailed information about it heredrizzle-typeboxhas 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
createSelectSchemafunction 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
- [FEATURE]: publish packages un-minified
- Don't allow unknown keys in drizzle-zod refinement
- [BUG]:drizzle-zod not working with pgSchema
- Add createUpdateSchema to drizzle-zod
- [BUG]:drizzle-zod produces wrong type
- [BUG]:Drizzle-zod:Boolean and Serial types from Schema are defined as enum<unknown> when using CreateInsertSchema and CreateSelectSchema
- [BUG]: Drizzle typebox enum array wrong schema and type
- [BUG]:drizzle-zod not working with pgSchema
- [BUG]: drizzle-zod not parsing arrays correctly
- [BUG]: Drizzle typebox not supporting array
- [FEATURE]: Export factory functions from drizzle-zod to allow usage with extended Zod classes
- [FEATURE]: Add support for new pipe syntax for drizzle-valibot
- [BUG]: drizzle-zod's createInsertSchema() can't handle column of type vector
- [BUG]: drizzle-typebox fails to map geometry column to type-box schema
- [BUG]: drizzle-valibot does not provide types for returned schemas
- [BUG]: Drizzle-typebox types SQLite real field to string
- [BUG]: drizzle-zod: documented usage generates type error with exactOptionalPropertyTypes
- [BUG]: drizzle-zod does not respect/count db type range
- [BUG]: drizzle-zod not overriding optional
- [BUG]:drizzle-zod doesn't accept custom id value
- [FEATURE]: Support for Database Views in Drizzle Zod
- [BUG]: drizzle-valibot return type any
- [BUG]: drizzle-zod Type generation results in undefined types
- [BUG]: GeneratedAlwaysAs
- [FEATURE]: $inferSelect on a view
- [BUG]:Can't infer props from view in schema
v0.37.0
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="@​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
*
* @​param request - The request submitted to the Worker from the client
* @​param env - The interface to reference bindings declared in wrangler.toml
* @​param ctx - The execution context of the Worker
* @​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: 'john@example.com',
})
console.log('New user created!')
const users = await stub.select();
console.log('Getting all users from the database: ', users)
return new Response();
}
}Bug fixes
shivammathur/setup-php (shivammathur/setup-php)
v2.35.5
Changelog
- Added support for macOS 26 based environments.
runs-on: macos-26
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2- Fixed resolving tools' releases to the latest one for a version prefix in tools input. (#1000)
For example, this should install the latest release of PHPUnit with
10.5as the prefix.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: phpunit:10.5.x- Improved installing
intlextension with a particular ICU versions.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: intl-77.1- Fixed tools setup to use the new
github-tokeninput value to avoid rate limits.
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
tools: phpcs: 4
github-token: ${{ secrets.GITHUB_TOKEN }}Improved errors when tools fail to install. (#991)
Fixed warning in get function on request failure.
Added a fallback source for composer phar archives. (#956)
Added a fallback source for PPA keys. (#996)
Fixed
opcache.jit_buffer_sizeconfig on arm environments. (#999)Updated Node.js dependencies.
For the complete list of changes, please refer to the Full Changelog
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.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
- If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.
6 changed files on the files tab, with 0 review threads.