-```
-
-Example
+ ```
+ [Pg-kit] Add PostGIS extension support
+ ```
-```
-[Pg-kit] Add PostGIS extension support
-```
+2. PRs should contain a detailed description of everything that was changed.
-2. PR should contain detailed description with everything, that was changed
+3. Commit messages should follow the [message style guidelines](#commit-message-guidelines).
-3. Each PR should contain
- - Tests on feature, that was created;
- - Tests on bugs, that was fixed;
+4. PRs should implement:
+ - Tests for features that were added.
+ - Tests for bugs that were fixed.
-To understand how test should be created and run - please check [Run tests](#run-tests) section
+> [!NOTE]
+> To understand how tests should be created and run, please check the [Running tests](#running-tests-kit) section.
diff --git a/README.md b/README.md
index ac509ab0d..4342d8afe 100644
--- a/README.md
+++ b/README.md
@@ -17,24 +17,24 @@
### What's Drizzle?
Drizzle is a modern TypeScript ORM developers [wanna use in their next project](https://stateofdb.com/tools/drizzle).
-It is [lightweight](https://bundlephobia.com/package/drizzle-orm) at only ~7.4kb minified+gzipped, it's tree shakeable with exactly 0 dependencies.
+It is [lightweight](https://bundlephobia.com/package/drizzle-orm) at only ~7.4kb minified+gzipped, and it's tree shakeable with exactly 0 dependencies.
-**Drizzle supports every PostgreSQL, MySQL and SQLite databases**, including serverless ones like [Turso](https://orm.drizzle.team/docs/get-started-sqlite#turso), [Neon](https://orm.drizzle.team/docs/get-started-postgresql#neon), [Xata](xata.io), [PlanetScale](https://orm.drizzle.team/docs/get-started-mysql#planetscale), [Cloudflare D1](https://orm.drizzle.team/docs/get-started-sqlite#cloudflare-d1), [FlyIO LiteFS](https://fly.io/docs/litefs/), [Vercel Postgres](https://orm.drizzle.team/docs/get-started-postgresql#vercel-postgres), [Supabase](https://orm.drizzle.team/docs/get-started-postgresql#supabase) and [AWS Data API](https://orm.drizzle.team/docs/get-started-postgresql#aws-data-api). No bells and whistles, no rust binaries, no serverless adapters, everything just works out of the box.
+**Drizzle supports every PostgreSQL, MySQL and SQLite database**, including serverless ones like [Turso](https://orm.drizzle.team/docs/get-started-sqlite#turso), [Neon](https://orm.drizzle.team/docs/get-started-postgresql#neon), [Xata](xata.io), [PlanetScale](https://orm.drizzle.team/docs/get-started-mysql#planetscale), [Cloudflare D1](https://orm.drizzle.team/docs/get-started-sqlite#cloudflare-d1), [FlyIO LiteFS](https://fly.io/docs/litefs/), [Vercel Postgres](https://orm.drizzle.team/docs/get-started-postgresql#vercel-postgres), [Supabase](https://orm.drizzle.team/docs/get-started-postgresql#supabase) and [AWS Data API](https://orm.drizzle.team/docs/get-started-postgresql#aws-data-api). No bells and whistles, no Rust binaries, no serverless adapters, everything just works out of the box.
-**Drizzle is serverless-ready by design**, it works in every major JavaScript runtime like NodeJS, Bun, Deno, Cloudflare Workers, Supabase functions, any Edge runtime and even in Browsers.
-With Drizzle you can be [**fast out of the box**](https://orm.drizzle.team/benchmarks), save time and costs while never introducing any data proxies into your infrastructure.
+**Drizzle is serverless-ready by design**. It works in every major JavaScript runtime like NodeJS, Bun, Deno, Cloudflare Workers, Supabase functions, any Edge runtime, and even in browsers.
+With Drizzle you can be [**fast out of the box**](https://orm.drizzle.team/benchmarks) and save time and costs while never introducing any data proxies into your infrastructure.
-While you can use Drizzle as a JavaScript library, it shines in the TypeScript. It lets you [**declare SQL schema**](https://orm.drizzle.team/docs/sql-schema-declaration) and build both [**relational**](https://orm.drizzle.team/docs/rqb) and [**SQL-like queries**](https://orm.drizzle.team/docs/select), while keeping the balance between type-safety and extensibility for toolmakers to build on top.
+While you can use Drizzle as a JavaScript library, it shines with TypeScript. It lets you [**declare SQL schemas**](https://orm.drizzle.team/docs/sql-schema-declaration) and build both [**relational**](https://orm.drizzle.team/docs/rqb) and [**SQL-like queries**](https://orm.drizzle.team/docs/select), while keeping the balance between type-safety and extensibility for toolmakers to build on top.
### Ecosystem
While Drizzle ORM remains a thin typed layer on top of SQL, we made a set of tools for people to have best possible developer experience.
-Drizzle comes with a powerful [**Drizzle Kit**](https://orm.drizzle.team/kit-docs/overview) CLI companion for you to have hasstle-free migrations. It can generate SQL migration files for you or apply schema changes directly to the database.
+Drizzle comes with a powerful [**Drizzle Kit**](https://orm.drizzle.team/kit-docs/overview) CLI companion for you to have hassle-free migrations. It can generate SQL migration files for you or apply schema changes directly to the database.
-And we have a [**Drizzle Studio**](https://orm.drizzle.team/drizzle-studio/overview) for you to effortlessly browse and manipulate data in your database of choice.
+We also have [**Drizzle Studio**](https://orm.drizzle.team/drizzle-studio/overview) for you to effortlessly browse and manipulate data in your database of choice.
### Documentation
-Check out the full documentation on [the website](https://orm.drizzle.team/docs/overview)
+Check out the full documentation on [the website](https://orm.drizzle.team/docs/overview).
### Our sponsors ❤️
diff --git a/changelogs/drizzle-kit/0.28.1.md b/changelogs/drizzle-kit/0.28.1.md
new file mode 100644
index 000000000..194b4bd57
--- /dev/null
+++ b/changelogs/drizzle-kit/0.28.1.md
@@ -0,0 +1,4 @@
+# Bug fixes
+
+- Fixed typos in repository: thanks @armandsalle, @masto, @wackbyte, @Asher-JH, @MaxLeiter
+- [fix: wrong dialect set in mysql/sqlite introspect](https://github.com/drizzle-team/drizzle-orm/pull/2865)
\ No newline at end of file
diff --git a/changelogs/drizzle-orm/0.36.2.md b/changelogs/drizzle-orm/0.36.2.md
new file mode 100644
index 000000000..3790e0944
--- /dev/null
+++ b/changelogs/drizzle-orm/0.36.2.md
@@ -0,0 +1,15 @@
+# New Features
+
+- [Support more types in like, notLike, ilike and notIlike expressions](https://github.com/drizzle-team/drizzle-orm/pull/2805)
+
+
+# Bug and typo fixes
+
+- Fixed typos in repository: thanks @armandsalle, @masto, @wackbyte, @Asher-JH, @MaxLeiter
+
+- [Fixed .generated behavior with non-strict tsconfig](https://github.com/drizzle-team/drizzle-orm/pull/3542)
+- [Fix Drizzle ORM for expo-sqlite](https://github.com/drizzle-team/drizzle-orm/pull/3197)
+- [Fixed lack of schema name on columns in sql](https://github.com/drizzle-team/drizzle-orm/pull/3531)
+- [fix: Adjust neon http driver entity kind](https://github.com/drizzle-team/drizzle-orm/pull/3424)
+- [Export PgIntegerBuilderInitial type](https://github.com/drizzle-team/drizzle-orm/pull/2846)
+- [[MySQL] Correct $returningId() implementation to correctly store selected fields](https://github.com/drizzle-team/drizzle-orm/pull/2975)
\ No newline at end of file
diff --git a/docs/custom-types.lite.md b/docs/custom-types.lite.md
index 627aba1a4..af1371461 100644
--- a/docs/custom-types.lite.md
+++ b/docs/custom-types.lite.md
@@ -1,6 +1,7 @@
# Common way of defining custom types
-> **Info**: For more advanced documentation about defining custom data types in PostgreSQL and MySQL please check [custom-types.md](https://github.com/drizzle-team/drizzle-orm/blob/main/docs/custom-types.md)
+> [!NOTE]
+> For more advanced documentation about defining custom data types in PostgreSQL and MySQL, please check [`custom-types.md`](custom-types.md).
## Examples
diff --git a/docs/custom-types.md b/docs/custom-types.md
index 1dffe6ce0..2a9f1a1da 100644
--- a/docs/custom-types.md
+++ b/docs/custom-types.md
@@ -1,7 +1,6 @@
# How to define custom types
Drizzle ORM has a big set of predefined column types for different SQL databases. But still there are additional types that are not supported by Drizzle ORM (yet). That could be native pg types or extension types
-
Here are some instructions on how to create and use your own types with Drizzle ORM
@@ -13,14 +12,11 @@ Each type creation should use 2 classes:
- `ColumnBuilder` - class, that is responsible for generating whole set of needed fields for column creation
- `Column` - class, that is representing Columns itself, that is used in query generation, migration mapping, etc.
-
-
+
Each module has it's own class, representing `ColumnBuilder` or `Column`:
- For `pg` -> `PgColumnBuilder` and `PgColumn`
- For `mysql` -> `MySqlColumnBuilder` and `MySqlColumn`
- For `sqlite` -> `SQLiteColumnBuilder` and `SQLiteColumn`
-
-
### Builder class explanation - (postgresql text data type example)
@@ -44,7 +40,7 @@ export class PgTextBuilder
}
```
-> **Warning**
+> [!WARNING]
> `$pgColumnBuilderBrand` should be changed and be equal to class name for new data type builder
### Column class explanation - (postgresql text data type example)
@@ -104,11 +100,8 @@ export class PgText
}
```
-> **Warning**
+> [!WARNING]
> `$pgColumnBrand` should be changed and be equal to class name for new data type
----
-
-
### Full text data type for PostgreSQL example
@@ -162,19 +155,13 @@ export function text(
## Custom data type example
----
-
-> **Note**
+> [!NOTE]
> We will check example on pg module, but current pattern applies to all dialects, that are currently supported by Drizzle ORM
-
-
### Setting up CITEXT datatype
----
-> **Note**
- This type is available only with extensions and used for example, just to show how you could setup any data type you want. Extension support will come soon
-
+> [!NOTE]
+> This type is available only with extensions and used for example, just to show how you could setup any data type you want. Extension support will come soon
### CITEXT data type example
@@ -224,4 +211,4 @@ You could add your created custom data types to Drizzle ORM, so everyone can use
Each data type should be placed in separate file in `columns` folder and PR open with tag `new-data-type:pg` | `new-data-type:sqlite` | `new-data-type:mysql`
-For more Contribution information - please check [CONTRIBUTING.md](https://github.com/drizzle-team/drizzle-orm/blob/main/CONTRIBUTING.md)
+For more Contribution information - please check [CONTRIBUTING.md](../CONTRIBUTING.md)
diff --git a/docs/joins.md b/docs/joins.md
index e0579e3e2..2b5829aa9 100644
--- a/docs/joins.md
+++ b/docs/joins.md
@@ -1,7 +1,7 @@
# Drizzle ORM - Joins
As with other parts of Drizzle ORM, the joins syntax is a balance between the SQL-likeness and type safety.
-Here's an example of how a common `1-to-many` relationship can be modelled.
+Here's an example of how a common "one-to-many" relationship can be modelled.
```typescript
const users = pgTable('users', {
@@ -96,7 +96,7 @@ In that case, the ORM will use dark TypeScript magic (as if it wasn't already) a
This is much more convenient! Now, you can just do a single check for `row.user !== null`, and all the user fields will become available.
-
+---
Note that you can group any fields in a nested object however you like, but the single check optimization will only be applied to a certain nested object if all its fields belong to the same table.
So, for example, you can group the city fields, too:
@@ -131,7 +131,7 @@ And the result type will look like this:
}
```
-
+---
If you just need all the fields from all the tables you're selecting and joining, you can simply omit the argument of the `.select()` method altogether:
@@ -139,7 +139,8 @@ If you just need all the fields from all the tables you're selecting and joining
const rows = await db.select().from(cities).leftJoin(users, eq(users.cityId, cities.id));
```
-> **Note**: in this case, the Drizzle table/column names will be used as the keys in the result object.
+> [!NOTE]
+> In this case, the Drizzle table/column names will be used as the keys in the result object.
```typescript
{
@@ -156,7 +157,7 @@ const rows = await db.select().from(cities).leftJoin(users, eq(users.cityId, cit
}[]
```
-
+---
There are cases where you'd want to select all the fields from one table, but pick fields from others. In that case, instead of listing all the table fields, you can just pass a table:
@@ -181,7 +182,7 @@ There are cases where you'd want to select all the fields from one table, but pi
}
```
-
+---
But what happens if you group columns from multiple tables in the same nested object? Nothing, really - they will still be all individually nullable, just grouped under the same object (as you might expect!):
diff --git a/drizzle-kit/README.md b/drizzle-kit/README.md
index d2a4191b7..bd69a4d3d 100644
--- a/drizzle-kit/README.md
+++ b/drizzle-kit/README.md
@@ -1,21 +1,21 @@
## Drizzle Kit
-DrizzleKit - is a CLI migrator tool for DrizzleORM. It is probably one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input.
+Drizzle Kit is a CLI migrator tool for Drizzle ORM. It is probably the one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input.
- is a mirror repository for issues.
## Documentation
-Check the full documenation on [the website](https://orm.drizzle.team/kit-docs/overview)
+Check the full documentation on [the website](https://orm.drizzle.team/kit-docs/overview).
### How it works
-`drizzle-kit` will traverse `schema folder` or `schema file`, generate schema snapshot and compare it to the previous version, if there's one.
- Based on the difference it will generate all needed SQL migrations and if there are any `automatically unresolvable` cases like `renames` it will prompt user for input.
+Drizzle Kit traverses a schema module and generates a snapshot to compare with the previous version, if there is one.
+Based on the difference, it will generate all needed SQL migrations. If there are any cases that can't be resolved automatically, such as renames, it will prompt the user for input.
-For schema file:
+For example, for this schema module:
```typescript
-// ./src/db/schema.ts
+// src/db/schema.ts
import { integer, pgTable, serial, text, varchar } from "drizzle-orm/pg-core";
@@ -63,7 +63,7 @@ CREATE INDEX IF NOT EXISTS users_full_name_index ON users (full_name);
npm install -D drizzle-kit
```
-Running with CLI options
+Running with CLI options:
```jsonc
// package.json
diff --git a/drizzle-kit/package.json b/drizzle-kit/package.json
index 1c911f23f..0b3b2562b 100644
--- a/drizzle-kit/package.json
+++ b/drizzle-kit/package.json
@@ -1,6 +1,6 @@
{
"name": "drizzle-kit",
- "version": "0.28.0",
+ "version": "0.28.1",
"homepage": "https://orm.drizzle.team",
"keywords": [
"drizzle",
diff --git a/drizzle-kit/src/cli/commands/introspect.ts b/drizzle-kit/src/cli/commands/introspect.ts
index db250d005..2629d000e 100644
--- a/drizzle-kit/src/cli/commands/introspect.ts
+++ b/drizzle-kit/src/cli/commands/introspect.ts
@@ -153,14 +153,14 @@ export const introspectPostgres = async (
chalk.green(
'✓',
)
- }] You schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
+ }] Your schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
);
render(
`[${
chalk.green(
'✓',
)
- }] You relations file is ready ➜ ${
+ }] Your relations file is ready ➜ ${
chalk.bold.underline.blue(
relationsFile,
)
@@ -264,14 +264,14 @@ export const introspectMysql = async (
chalk.green(
'✓',
)
- }] You schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
+ }] Your schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
);
render(
`[${
chalk.green(
'✓',
)
- }] You relations file is ready ➜ ${
+ }] Your relations file is ready ➜ ${
chalk.bold.underline.blue(
relationsFile,
)
@@ -488,14 +488,14 @@ export const introspectLibSQL = async (
chalk.green(
'✓',
)
- }] You schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
+ }] Your schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
);
render(
`[${
chalk.green(
'✓',
)
- }] You relations file is ready ➜ ${
+ }] Your relations file is ready ➜ ${
chalk.bold.underline.blue(
relationsFile,
)
diff --git a/drizzle-kit/src/cli/commands/migrate.ts b/drizzle-kit/src/cli/commands/migrate.ts
index 0933af194..92770e99d 100644
--- a/drizzle-kit/src/cli/commands/migrate.ts
+++ b/drizzle-kit/src/cli/commands/migrate.ts
@@ -1078,7 +1078,7 @@ export const writeResult = ({
if (type === 'custom') {
console.log('Prepared empty file for your custom SQL migration!');
- sql = '-- Custom SQL migration file, put you code below! --';
+ sql = '-- Custom SQL migration file, put your code below! --';
}
journal.entries.push({
diff --git a/drizzle-orm/package.json b/drizzle-orm/package.json
index b2b204ead..41852bfa7 100644
--- a/drizzle-orm/package.json
+++ b/drizzle-orm/package.json
@@ -1,6 +1,6 @@
{
"name": "drizzle-orm",
- "version": "0.36.1",
+ "version": "0.36.2",
"description": "Drizzle ORM package for SQL databases",
"type": "module",
"scripts": {
@@ -63,7 +63,7 @@
"@xata.io/client": "*",
"better-sqlite3": ">=7",
"bun-types": "*",
- "expo-sqlite": ">=13.2.0",
+ "expo-sqlite": ">=14.0.0",
"knex": "*",
"kysely": "*",
"mysql2": ">=2",
@@ -186,7 +186,7 @@
"better-sqlite3": "^8.4.0",
"bun-types": "^0.6.6",
"cpy": "^10.1.0",
- "expo-sqlite": "^13.2.0",
+ "expo-sqlite": "^14.0.0",
"knex": "^2.4.2",
"kysely": "^0.25.0",
"mysql2": "^3.3.3",
diff --git a/drizzle-orm/src/column-builder.ts b/drizzle-orm/src/column-builder.ts
index fb7da9ef6..e53e5ca0d 100644
--- a/drizzle-orm/src/column-builder.ts
+++ b/drizzle-orm/src/column-builder.ts
@@ -42,7 +42,6 @@ export interface ColumnBuilderBaseConfig | undefined;
}
export type MakeColumnConfig<
@@ -64,7 +63,10 @@ export type MakeColumnConfig<
enumValues: T['enumValues'];
baseColumn: T extends { baseBuilder: infer U extends ColumnBuilderBase } ? BuildColumn
: never;
- generated: T['generated'] extends object ? T['generated'] : undefined;
+ generated: T extends { generated: infer G } ? unknown extends G ? undefined
+ : G extends undefined ? undefined
+ : G
+ : undefined;
} & {};
export type ColumnBuilderTypeConfig<
@@ -82,7 +84,7 @@ export type ColumnBuilderTypeConfig<
notNull: T extends { notNull: infer U } ? U : boolean;
hasDefault: T extends { hasDefault: infer U } ? U : boolean;
enumValues: T['enumValues'];
- generated: GeneratedColumnConfig | undefined;
+ generated: T extends { generated: infer G } ? G extends undefined ? unknown : G : unknown;
}
& TTypeConfig
>;
@@ -294,7 +296,9 @@ export abstract class ColumnBuilder<
abstract generatedAlwaysAs(
as: SQL | T['data'] | (() => SQL),
config?: Partial>,
- ): HasGenerated;
+ ): HasGenerated;
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
setName(name: string) {
diff --git a/drizzle-orm/src/expo-sqlite/driver.ts b/drizzle-orm/src/expo-sqlite/driver.ts
index 6d9ebe375..fce53eed2 100644
--- a/drizzle-orm/src/expo-sqlite/driver.ts
+++ b/drizzle-orm/src/expo-sqlite/driver.ts
@@ -1,4 +1,4 @@
-import type { SQLiteDatabase, SQLiteRunResult } from 'expo-sqlite/next';
+import type { SQLiteDatabase, SQLiteRunResult } from 'expo-sqlite';
import { entityKind } from '~/entity.ts';
import { DefaultLogger } from '~/logger.ts';
import {
diff --git a/drizzle-orm/src/expo-sqlite/query.ts b/drizzle-orm/src/expo-sqlite/query.ts
index 8d9c5e4d9..a38fc3046 100644
--- a/drizzle-orm/src/expo-sqlite/query.ts
+++ b/drizzle-orm/src/expo-sqlite/query.ts
@@ -1,4 +1,4 @@
-import { addDatabaseChangeListener } from 'expo-sqlite/next';
+import { addDatabaseChangeListener } from 'expo-sqlite';
import { useEffect, useState } from 'react';
import { is } from '~/entity.ts';
import { SQL } from '~/sql/sql.ts';
diff --git a/drizzle-orm/src/expo-sqlite/session.ts b/drizzle-orm/src/expo-sqlite/session.ts
index 9fcc4b93c..cb880ac6e 100644
--- a/drizzle-orm/src/expo-sqlite/session.ts
+++ b/drizzle-orm/src/expo-sqlite/session.ts
@@ -1,4 +1,4 @@
-import type { SQLiteDatabase, SQLiteRunResult, SQLiteStatement } from 'expo-sqlite/next';
+import type { SQLiteDatabase, SQLiteRunResult, SQLiteStatement } from 'expo-sqlite';
import { entityKind } from '~/entity.ts';
import type { Logger } from '~/logger.ts';
import { NoopLogger } from '~/logger.ts';
diff --git a/drizzle-orm/src/mysql-core/columns/bigint.ts b/drizzle-orm/src/mysql-core/columns/bigint.ts
index 7411c07ce..0973a1346 100644
--- a/drizzle-orm/src/mysql-core/columns/bigint.ts
+++ b/drizzle-orm/src/mysql-core/columns/bigint.ts
@@ -12,7 +12,6 @@ export type MySqlBigInt53BuilderInitial = MySqlBigInt53Bui
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlBigInt53Builder>
@@ -60,7 +59,6 @@ export type MySqlBigInt64BuilderInitial = MySqlBigInt64Bui
data: bigint;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlBigInt64Builder>
diff --git a/drizzle-orm/src/mysql-core/columns/binary.ts b/drizzle-orm/src/mysql-core/columns/binary.ts
index 7031b565c..e67006653 100644
--- a/drizzle-orm/src/mysql-core/columns/binary.ts
+++ b/drizzle-orm/src/mysql-core/columns/binary.ts
@@ -12,7 +12,6 @@ export type MySqlBinaryBuilderInitial = MySqlBinaryBuilder
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlBinaryBuilder> extends MySqlColumnBuilder<
diff --git a/drizzle-orm/src/mysql-core/columns/boolean.ts b/drizzle-orm/src/mysql-core/columns/boolean.ts
index 9e786b6f9..2057496b6 100644
--- a/drizzle-orm/src/mysql-core/columns/boolean.ts
+++ b/drizzle-orm/src/mysql-core/columns/boolean.ts
@@ -11,7 +11,6 @@ export type MySqlBooleanBuilderInitial = MySqlBooleanBuild
data: boolean;
driverParam: number | boolean;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlBooleanBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/char.ts b/drizzle-orm/src/mysql-core/columns/char.ts
index efcb7e65a..88492288e 100644
--- a/drizzle-orm/src/mysql-core/columns/char.ts
+++ b/drizzle-orm/src/mysql-core/columns/char.ts
@@ -12,7 +12,6 @@ export type MySqlCharBuilderInitial;
export class MySqlCharBuilder> extends MySqlColumnBuilder<
diff --git a/drizzle-orm/src/mysql-core/columns/common.ts b/drizzle-orm/src/mysql-core/columns/common.ts
index 9babc31da..2f1073e53 100644
--- a/drizzle-orm/src/mysql-core/columns/common.ts
+++ b/drizzle-orm/src/mysql-core/columns/common.ts
@@ -62,7 +62,9 @@ export abstract class MySqlColumnBuilder<
return this;
}
- generatedAlwaysAs(as: SQL | T['data'] | (() => SQL), config?: MySqlGeneratedColumnConfig): HasGenerated {
+ generatedAlwaysAs(as: SQL | T['data'] | (() => SQL), config?: MySqlGeneratedColumnConfig): HasGenerated {
this.config.generated = {
as,
type: 'always',
diff --git a/drizzle-orm/src/mysql-core/columns/custom.ts b/drizzle-orm/src/mysql-core/columns/custom.ts
index 711b27813..50585bece 100644
--- a/drizzle-orm/src/mysql-core/columns/custom.ts
+++ b/drizzle-orm/src/mysql-core/columns/custom.ts
@@ -14,7 +14,6 @@ export type ConvertCustomConfig = MySqlDateBuilder<{
data: Date;
driverParam: string | number;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlDateBuilder> extends MySqlColumnBuilder {
@@ -56,7 +55,6 @@ export type MySqlDateStringBuilderInitial = MySqlDateStrin
data: string;
driverParam: string | number;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlDateStringBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/datetime.ts b/drizzle-orm/src/mysql-core/columns/datetime.ts
index 61b062e8f..ea5b917b9 100644
--- a/drizzle-orm/src/mysql-core/columns/datetime.ts
+++ b/drizzle-orm/src/mysql-core/columns/datetime.ts
@@ -12,7 +12,6 @@ export type MySqlDateTimeBuilderInitial = MySqlDateTimeBui
data: Date;
driverParam: string | number;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlDateTimeBuilder>
@@ -70,7 +69,6 @@ export type MySqlDateTimeStringBuilderInitial = MySqlDateT
data: string;
driverParam: string | number;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlDateTimeStringBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/decimal.ts b/drizzle-orm/src/mysql-core/columns/decimal.ts
index 67cefb531..76b0ba8a1 100644
--- a/drizzle-orm/src/mysql-core/columns/decimal.ts
+++ b/drizzle-orm/src/mysql-core/columns/decimal.ts
@@ -12,7 +12,6 @@ export type MySqlDecimalBuilderInitial = MySqlDecimalBuild
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlDecimalBuilder<
diff --git a/drizzle-orm/src/mysql-core/columns/double.ts b/drizzle-orm/src/mysql-core/columns/double.ts
index dfe5fca2e..bc23fc74c 100644
--- a/drizzle-orm/src/mysql-core/columns/double.ts
+++ b/drizzle-orm/src/mysql-core/columns/double.ts
@@ -12,7 +12,6 @@ export type MySqlDoubleBuilderInitial = MySqlDoubleBuilder
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlDoubleBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/enum.ts b/drizzle-orm/src/mysql-core/columns/enum.ts
index 6a586ca7c..384e07d17 100644
--- a/drizzle-orm/src/mysql-core/columns/enum.ts
+++ b/drizzle-orm/src/mysql-core/columns/enum.ts
@@ -13,7 +13,6 @@ export type MySqlEnumColumnBuilderInitial;
export class MySqlEnumColumnBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/float.ts b/drizzle-orm/src/mysql-core/columns/float.ts
index 12ebd3e74..e368740a0 100644
--- a/drizzle-orm/src/mysql-core/columns/float.ts
+++ b/drizzle-orm/src/mysql-core/columns/float.ts
@@ -12,7 +12,6 @@ export type MySqlFloatBuilderInitial = MySqlFloatBuilder<{
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlFloatBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/int.ts b/drizzle-orm/src/mysql-core/columns/int.ts
index aca0ea61e..79b93bdf7 100644
--- a/drizzle-orm/src/mysql-core/columns/int.ts
+++ b/drizzle-orm/src/mysql-core/columns/int.ts
@@ -12,7 +12,6 @@ export type MySqlIntBuilderInitial = MySqlIntBuilder<{
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlIntBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/json.ts b/drizzle-orm/src/mysql-core/columns/json.ts
index ecb73ed82..12d11bd4a 100644
--- a/drizzle-orm/src/mysql-core/columns/json.ts
+++ b/drizzle-orm/src/mysql-core/columns/json.ts
@@ -11,7 +11,6 @@ export type MySqlJsonBuilderInitial = MySqlJsonBuilder<{
data: unknown;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlJsonBuilder> extends MySqlColumnBuilder {
diff --git a/drizzle-orm/src/mysql-core/columns/mediumint.ts b/drizzle-orm/src/mysql-core/columns/mediumint.ts
index 764969d31..7ba5cc944 100644
--- a/drizzle-orm/src/mysql-core/columns/mediumint.ts
+++ b/drizzle-orm/src/mysql-core/columns/mediumint.ts
@@ -13,7 +13,6 @@ export type MySqlMediumIntBuilderInitial = MySqlMediumIntB
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlMediumIntBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/real.ts b/drizzle-orm/src/mysql-core/columns/real.ts
index 8b9eca794..c6b447310 100644
--- a/drizzle-orm/src/mysql-core/columns/real.ts
+++ b/drizzle-orm/src/mysql-core/columns/real.ts
@@ -12,7 +12,6 @@ export type MySqlRealBuilderInitial = MySqlRealBuilder<{
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlRealBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/serial.ts b/drizzle-orm/src/mysql-core/columns/serial.ts
index 88485d6b2..90fd7a2e5 100644
--- a/drizzle-orm/src/mysql-core/columns/serial.ts
+++ b/drizzle-orm/src/mysql-core/columns/serial.ts
@@ -23,7 +23,6 @@ export type MySqlSerialBuilderInitial = IsAutoincrement<
data: number;
driverParam: number;
enumValues: undefined;
- generated: undefined;
}>
>
>
diff --git a/drizzle-orm/src/mysql-core/columns/smallint.ts b/drizzle-orm/src/mysql-core/columns/smallint.ts
index 482ff89ea..87083f0fa 100644
--- a/drizzle-orm/src/mysql-core/columns/smallint.ts
+++ b/drizzle-orm/src/mysql-core/columns/smallint.ts
@@ -13,7 +13,6 @@ export type MySqlSmallIntBuilderInitial = MySqlSmallIntBui
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlSmallIntBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/text.ts b/drizzle-orm/src/mysql-core/columns/text.ts
index 18434a532..0604ef141 100644
--- a/drizzle-orm/src/mysql-core/columns/text.ts
+++ b/drizzle-orm/src/mysql-core/columns/text.ts
@@ -14,7 +14,6 @@ export type MySqlTextBuilderInitial;
export class MySqlTextBuilder> extends MySqlColumnBuilder<
diff --git a/drizzle-orm/src/mysql-core/columns/time.ts b/drizzle-orm/src/mysql-core/columns/time.ts
index 408453947..7ca5426ec 100644
--- a/drizzle-orm/src/mysql-core/columns/time.ts
+++ b/drizzle-orm/src/mysql-core/columns/time.ts
@@ -12,7 +12,6 @@ export type MySqlTimeBuilderInitial = MySqlTimeBuilder<{
data: string;
driverParam: string | number;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlTimeBuilder> extends MySqlColumnBuilder<
diff --git a/drizzle-orm/src/mysql-core/columns/timestamp.ts b/drizzle-orm/src/mysql-core/columns/timestamp.ts
index 892f8e603..2ccc2925f 100644
--- a/drizzle-orm/src/mysql-core/columns/timestamp.ts
+++ b/drizzle-orm/src/mysql-core/columns/timestamp.ts
@@ -12,7 +12,6 @@ export type MySqlTimestampBuilderInitial = MySqlTimestampB
data: Date;
driverParam: string | number;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlTimestampBuilder>
@@ -64,7 +63,6 @@ export type MySqlTimestampStringBuilderInitial = MySqlTime
data: string;
driverParam: string | number;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlTimestampStringBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/tinyint.ts b/drizzle-orm/src/mysql-core/columns/tinyint.ts
index ee4ccdaa7..890f169bd 100644
--- a/drizzle-orm/src/mysql-core/columns/tinyint.ts
+++ b/drizzle-orm/src/mysql-core/columns/tinyint.ts
@@ -13,7 +13,6 @@ export type MySqlTinyIntBuilderInitial = MySqlTinyIntBuild
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlTinyIntBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/varbinary.ts b/drizzle-orm/src/mysql-core/columns/varbinary.ts
index bc0dde635..837de8dcb 100644
--- a/drizzle-orm/src/mysql-core/columns/varbinary.ts
+++ b/drizzle-orm/src/mysql-core/columns/varbinary.ts
@@ -12,7 +12,6 @@ export type MySqlVarBinaryBuilderInitial = MySqlVarBinaryB
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlVarBinaryBuilder>
diff --git a/drizzle-orm/src/mysql-core/columns/varchar.ts b/drizzle-orm/src/mysql-core/columns/varchar.ts
index 32cfda7e9..6a335fef7 100644
--- a/drizzle-orm/src/mysql-core/columns/varchar.ts
+++ b/drizzle-orm/src/mysql-core/columns/varchar.ts
@@ -13,7 +13,6 @@ export type MySqlVarCharBuilderInitial;
diff --git a/drizzle-orm/src/mysql-core/columns/year.ts b/drizzle-orm/src/mysql-core/columns/year.ts
index 8a7a44410..4e4ae4faf 100644
--- a/drizzle-orm/src/mysql-core/columns/year.ts
+++ b/drizzle-orm/src/mysql-core/columns/year.ts
@@ -11,7 +11,6 @@ export type MySqlYearBuilderInitial = MySqlYearBuilder<{
data: number;
driverParam: number;
enumValues: undefined;
- generated: undefined;
}>;
export class MySqlYearBuilder> extends MySqlColumnBuilder {
diff --git a/drizzle-orm/src/mysql-core/query-builders/insert.ts b/drizzle-orm/src/mysql-core/query-builders/insert.ts
index fe9f7d7ba..f3b4eec21 100644
--- a/drizzle-orm/src/mysql-core/query-builders/insert.ts
+++ b/drizzle-orm/src/mysql-core/query-builders/insert.ts
@@ -16,8 +16,8 @@ import type { Placeholder, Query, SQLWrapper } from '~/sql/sql.ts';
import { Param, SQL, sql } from '~/sql/sql.ts';
import type { InferModelFromColumns } from '~/table.ts';
import { Table } from '~/table.ts';
-import { mapUpdateSet, orderSelectedFields } from '~/utils.ts';
-import type { AnyMySqlColumn, MySqlColumn } from '../columns/common.ts';
+import { mapUpdateSet } from '~/utils.ts';
+import type { AnyMySqlColumn } from '../columns/common.ts';
import type { SelectedFieldsOrdered } from './select.types.ts';
import type { MySqlUpdateSetSource } from './update.ts';
@@ -210,7 +210,7 @@ export class MySqlInsertBase<
/**
* Adds an `on duplicate key update` clause to the query.
*
- * Calling this method will update update the row if any unique index conflicts. MySQL will automatically determine the conflict target based on the primary key and unique indexes.
+ * Calling this method will update the row if any unique index conflicts. MySQL will automatically determine the conflict target based on the primary key and unique indexes.
*
* See docs: {@link https://orm.drizzle.team/docs/insert#on-duplicate-key-update}
*
@@ -252,7 +252,7 @@ export class MySqlInsertBase<
returning.push({ field: value, path: [key] });
}
}
- this.config.returning = orderSelectedFields(this.config.table[Table.Symbol.Columns]);
+ this.config.returning = returning;
return this as any;
}
diff --git a/drizzle-orm/src/neon-http/driver.ts b/drizzle-orm/src/neon-http/driver.ts
index 4ef1dc36a..cfa0c7861 100644
--- a/drizzle-orm/src/neon-http/driver.ts
+++ b/drizzle-orm/src/neon-http/driver.ts
@@ -16,7 +16,7 @@ export interface NeonDriverOptions {
}
export class NeonHttpDriver {
- static readonly [entityKind]: string = 'NeonDriver';
+ static readonly [entityKind]: string = 'NeonHttpDriver';
constructor(
private client: NeonHttpClient,
diff --git a/drizzle-orm/src/operations.ts b/drizzle-orm/src/operations.ts
index 6fb5cbd2e..573e05957 100644
--- a/drizzle-orm/src/operations.ts
+++ b/drizzle-orm/src/operations.ts
@@ -1,4 +1,5 @@
import type { AnyColumn, Column } from './column.ts';
+import type { GeneratedColumnConfig } from './index.ts';
import type { SQL } from './sql/sql.ts';
import type { Table } from './table.ts';
@@ -8,17 +9,16 @@ export type RequiredKeyOnly = T extends A
}> ? TKey
: never;
-export type NotGenerated = T extends AnyColumn<{
- generated: undefined;
-}> ? TKey
- : never;
-
export type OptionalKeyOnly<
TKey extends string,
T extends Column,
> = TKey extends RequiredKeyOnly ? never
- : TKey extends NotGenerated ? TKey
- : T['_']['generated'] extends object ? T['_']['generated']['type'] extends 'byDefault' ? TKey : never
+ : T extends {
+ _: {
+ generated: infer G;
+ };
+ } ? G extends GeneratedColumnConfig ? G['type'] extends 'always' ? never : TKey
+ : TKey
: never;
// TODO: SQL -> SQLWrapper
diff --git a/drizzle-orm/src/pg-core/columns/bigint.ts b/drizzle-orm/src/pg-core/columns/bigint.ts
index 23e1e7f15..17ac0798b 100644
--- a/drizzle-orm/src/pg-core/columns/bigint.ts
+++ b/drizzle-orm/src/pg-core/columns/bigint.ts
@@ -14,7 +14,6 @@ export type PgBigInt53BuilderInitial = PgBigInt53Builder<{
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgBigInt53Builder>
@@ -56,7 +55,6 @@ export type PgBigInt64BuilderInitial = PgBigInt64Builder<{
data: bigint;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgBigInt64Builder>
diff --git a/drizzle-orm/src/pg-core/columns/bigserial.ts b/drizzle-orm/src/pg-core/columns/bigserial.ts
index ed4224354..0aa7e7a7f 100644
--- a/drizzle-orm/src/pg-core/columns/bigserial.ts
+++ b/drizzle-orm/src/pg-core/columns/bigserial.ts
@@ -20,7 +20,6 @@ export type PgBigSerial53BuilderInitial = NotNull<
data: number;
driverParam: number;
enumValues: undefined;
- generated: undefined;
}>
>
>;
@@ -71,7 +70,6 @@ export type PgBigSerial64BuilderInitial = NotNull<
data: bigint;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>
>
>;
diff --git a/drizzle-orm/src/pg-core/columns/boolean.ts b/drizzle-orm/src/pg-core/columns/boolean.ts
index cd30895c7..e2d514864 100644
--- a/drizzle-orm/src/pg-core/columns/boolean.ts
+++ b/drizzle-orm/src/pg-core/columns/boolean.ts
@@ -11,7 +11,6 @@ export type PgBooleanBuilderInitial = PgBooleanBuilder<{
data: boolean;
driverParam: boolean;
enumValues: undefined;
- generated: undefined;
}>;
export class PgBooleanBuilder> extends PgColumnBuilder {
diff --git a/drizzle-orm/src/pg-core/columns/char.ts b/drizzle-orm/src/pg-core/columns/char.ts
index 6629f08cc..2cc304221 100644
--- a/drizzle-orm/src/pg-core/columns/char.ts
+++ b/drizzle-orm/src/pg-core/columns/char.ts
@@ -12,7 +12,6 @@ export type PgCharBuilderInitial;
export class PgCharBuilder> extends PgColumnBuilder<
diff --git a/drizzle-orm/src/pg-core/columns/cidr.ts b/drizzle-orm/src/pg-core/columns/cidr.ts
index 6caa3dc25..ab97536ee 100644
--- a/drizzle-orm/src/pg-core/columns/cidr.ts
+++ b/drizzle-orm/src/pg-core/columns/cidr.ts
@@ -11,7 +11,6 @@ export type PgCidrBuilderInitial = PgCidrBuilder<{
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgCidrBuilder> extends PgColumnBuilder {
diff --git a/drizzle-orm/src/pg-core/columns/common.ts b/drizzle-orm/src/pg-core/columns/common.ts
index c2fbe8cb9..de2267cf3 100644
--- a/drizzle-orm/src/pg-core/columns/common.ts
+++ b/drizzle-orm/src/pg-core/columns/common.ts
@@ -83,13 +83,17 @@ export abstract class PgColumnBuilder<
return this;
}
- generatedAlwaysAs(as: SQL | T['data'] | (() => SQL)): HasGenerated {
+ generatedAlwaysAs(as: SQL | T['data'] | (() => SQL)): HasGenerated {
this.config.generated = {
as,
type: 'always',
mode: 'stored',
};
- return this as any;
+ return this as HasGenerated;
}
/** @internal */
diff --git a/drizzle-orm/src/pg-core/columns/custom.ts b/drizzle-orm/src/pg-core/columns/custom.ts
index b59169ed6..f4f622ff6 100644
--- a/drizzle-orm/src/pg-core/columns/custom.ts
+++ b/drizzle-orm/src/pg-core/columns/custom.ts
@@ -14,7 +14,6 @@ export type ConvertCustomConfig = PgDateBuilder<{
data: Date;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgDateBuilder> extends PgDateColumnBaseBuilder {
@@ -54,7 +53,6 @@ export type PgDateStringBuilderInitial = PgDateStringBuild
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgDateStringBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/double-precision.ts b/drizzle-orm/src/pg-core/columns/double-precision.ts
index 77245ea45..942085bc1 100644
--- a/drizzle-orm/src/pg-core/columns/double-precision.ts
+++ b/drizzle-orm/src/pg-core/columns/double-precision.ts
@@ -11,7 +11,6 @@ export type PgDoublePrecisionBuilderInitial = PgDoublePrec
data: number;
driverParam: string | number;
enumValues: undefined;
- generated: undefined;
}>;
export class PgDoublePrecisionBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/enum.ts b/drizzle-orm/src/pg-core/columns/enum.ts
index 7712ca606..db7905b39 100644
--- a/drizzle-orm/src/pg-core/columns/enum.ts
+++ b/drizzle-orm/src/pg-core/columns/enum.ts
@@ -13,7 +13,6 @@ export type PgEnumColumnBuilderInitial;
const isPgEnumSym = Symbol.for('drizzle:isPgEnum');
diff --git a/drizzle-orm/src/pg-core/columns/inet.ts b/drizzle-orm/src/pg-core/columns/inet.ts
index 6b6210fcf..741bbdf86 100644
--- a/drizzle-orm/src/pg-core/columns/inet.ts
+++ b/drizzle-orm/src/pg-core/columns/inet.ts
@@ -11,7 +11,6 @@ export type PgInetBuilderInitial = PgInetBuilder<{
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgInetBuilder> extends PgColumnBuilder {
diff --git a/drizzle-orm/src/pg-core/columns/integer.ts b/drizzle-orm/src/pg-core/columns/integer.ts
index bb70f9b41..9be92bb34 100644
--- a/drizzle-orm/src/pg-core/columns/integer.ts
+++ b/drizzle-orm/src/pg-core/columns/integer.ts
@@ -5,14 +5,13 @@ import type { AnyPgTable } from '../table.ts';
import { PgColumn } from './common.ts';
import { PgIntColumnBaseBuilder } from './int.common.ts';
-type PgIntegerBuilderInitial = PgIntegerBuilder<{
+export type PgIntegerBuilderInitial = PgIntegerBuilder<{
name: TName;
dataType: 'number';
columnType: 'PgInteger';
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgIntegerBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/interval.ts b/drizzle-orm/src/pg-core/columns/interval.ts
index 4d3ed4588..8f81e9867 100644
--- a/drizzle-orm/src/pg-core/columns/interval.ts
+++ b/drizzle-orm/src/pg-core/columns/interval.ts
@@ -13,7 +13,6 @@ export type PgIntervalBuilderInitial = PgIntervalBuilder<{
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgIntervalBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/json.ts b/drizzle-orm/src/pg-core/columns/json.ts
index 3c440c7d2..deed256b9 100644
--- a/drizzle-orm/src/pg-core/columns/json.ts
+++ b/drizzle-orm/src/pg-core/columns/json.ts
@@ -11,7 +11,6 @@ export type PgJsonBuilderInitial = PgJsonBuilder<{
data: unknown;
driverParam: unknown;
enumValues: undefined;
- generated: undefined;
}>;
export class PgJsonBuilder> extends PgColumnBuilder<
diff --git a/drizzle-orm/src/pg-core/columns/jsonb.ts b/drizzle-orm/src/pg-core/columns/jsonb.ts
index 3407730db..14af7c9e9 100644
--- a/drizzle-orm/src/pg-core/columns/jsonb.ts
+++ b/drizzle-orm/src/pg-core/columns/jsonb.ts
@@ -11,7 +11,6 @@ export type PgJsonbBuilderInitial = PgJsonbBuilder<{
data: unknown;
driverParam: unknown;
enumValues: undefined;
- generated: undefined;
}>;
export class PgJsonbBuilder> extends PgColumnBuilder {
diff --git a/drizzle-orm/src/pg-core/columns/line.ts b/drizzle-orm/src/pg-core/columns/line.ts
index 014140797..9378d1aa1 100644
--- a/drizzle-orm/src/pg-core/columns/line.ts
+++ b/drizzle-orm/src/pg-core/columns/line.ts
@@ -13,7 +13,6 @@ export type PgLineBuilderInitial = PgLineBuilder<{
data: [number, number, number];
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgLineBuilder> extends PgColumnBuilder {
@@ -58,7 +57,6 @@ export type PgLineABCBuilderInitial = PgLineABCBuilder<{
data: { a: number; b: number; c: number };
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgLineABCBuilder> extends PgColumnBuilder {
diff --git a/drizzle-orm/src/pg-core/columns/macaddr.ts b/drizzle-orm/src/pg-core/columns/macaddr.ts
index bfc4511f4..bcd8b02bc 100644
--- a/drizzle-orm/src/pg-core/columns/macaddr.ts
+++ b/drizzle-orm/src/pg-core/columns/macaddr.ts
@@ -11,7 +11,6 @@ export type PgMacaddrBuilderInitial = PgMacaddrBuilder<{
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgMacaddrBuilder> extends PgColumnBuilder {
diff --git a/drizzle-orm/src/pg-core/columns/macaddr8.ts b/drizzle-orm/src/pg-core/columns/macaddr8.ts
index 6c4218de0..e9e3e4bef 100644
--- a/drizzle-orm/src/pg-core/columns/macaddr8.ts
+++ b/drizzle-orm/src/pg-core/columns/macaddr8.ts
@@ -11,7 +11,6 @@ export type PgMacaddr8BuilderInitial = PgMacaddr8Builder<{
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgMacaddr8Builder> extends PgColumnBuilder {
diff --git a/drizzle-orm/src/pg-core/columns/numeric.ts b/drizzle-orm/src/pg-core/columns/numeric.ts
index efeb4ab97..fc58d9859 100644
--- a/drizzle-orm/src/pg-core/columns/numeric.ts
+++ b/drizzle-orm/src/pg-core/columns/numeric.ts
@@ -12,7 +12,6 @@ export type PgNumericBuilderInitial = PgNumericBuilder<{
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgNumericBuilder> extends PgColumnBuilder<
diff --git a/drizzle-orm/src/pg-core/columns/point.ts b/drizzle-orm/src/pg-core/columns/point.ts
index 827579ad8..c204aedea 100644
--- a/drizzle-orm/src/pg-core/columns/point.ts
+++ b/drizzle-orm/src/pg-core/columns/point.ts
@@ -13,7 +13,6 @@ export type PgPointTupleBuilderInitial = PgPointTupleBuild
data: [number, number];
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgPointTupleBuilder>
@@ -63,7 +62,6 @@ export type PgPointObjectBuilderInitial = PgPointObjectBui
data: { x: number; y: number };
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgPointObjectBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/postgis_extension/geometry.ts b/drizzle-orm/src/pg-core/columns/postgis_extension/geometry.ts
index 853c3dff9..93632d31c 100644
--- a/drizzle-orm/src/pg-core/columns/postgis_extension/geometry.ts
+++ b/drizzle-orm/src/pg-core/columns/postgis_extension/geometry.ts
@@ -14,7 +14,6 @@ export type PgGeometryBuilderInitial = PgGeometryBuilder<{
data: [number, number];
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgGeometryBuilder> extends PgColumnBuilder {
@@ -58,7 +57,6 @@ export type PgGeometryObjectBuilderInitial = PgGeometryObj
data: { x: number; y: number };
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgGeometryObjectBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/real.ts b/drizzle-orm/src/pg-core/columns/real.ts
index 0e3de4b2e..b3c339c9b 100644
--- a/drizzle-orm/src/pg-core/columns/real.ts
+++ b/drizzle-orm/src/pg-core/columns/real.ts
@@ -11,7 +11,6 @@ export type PgRealBuilderInitial = PgRealBuilder<{
data: number;
driverParam: string | number;
enumValues: undefined;
- generated: undefined;
}>;
export class PgRealBuilder> extends PgColumnBuilder<
diff --git a/drizzle-orm/src/pg-core/columns/serial.ts b/drizzle-orm/src/pg-core/columns/serial.ts
index 6a0196c38..261ef2af9 100644
--- a/drizzle-orm/src/pg-core/columns/serial.ts
+++ b/drizzle-orm/src/pg-core/columns/serial.ts
@@ -19,7 +19,6 @@ export type PgSerialBuilderInitial = NotNull<
data: number;
driverParam: number;
enumValues: undefined;
- generated: undefined;
}>
>
>;
diff --git a/drizzle-orm/src/pg-core/columns/smallint.ts b/drizzle-orm/src/pg-core/columns/smallint.ts
index 1cdfe141f..e662904b5 100644
--- a/drizzle-orm/src/pg-core/columns/smallint.ts
+++ b/drizzle-orm/src/pg-core/columns/smallint.ts
@@ -12,7 +12,6 @@ export type PgSmallIntBuilderInitial = PgSmallIntBuilder<{
data: number;
driverParam: number | string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgSmallIntBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/smallserial.ts b/drizzle-orm/src/pg-core/columns/smallserial.ts
index 456dc47f7..c92fc8350 100644
--- a/drizzle-orm/src/pg-core/columns/smallserial.ts
+++ b/drizzle-orm/src/pg-core/columns/smallserial.ts
@@ -19,7 +19,6 @@ export type PgSmallSerialBuilderInitial = NotNull<
data: number;
driverParam: number;
enumValues: undefined;
- generated: undefined;
}>
>
>;
diff --git a/drizzle-orm/src/pg-core/columns/text.ts b/drizzle-orm/src/pg-core/columns/text.ts
index 6845f0e74..980f0ec2f 100644
--- a/drizzle-orm/src/pg-core/columns/text.ts
+++ b/drizzle-orm/src/pg-core/columns/text.ts
@@ -12,7 +12,6 @@ type PgTextBuilderInitial;
export class PgTextBuilder<
diff --git a/drizzle-orm/src/pg-core/columns/time.ts b/drizzle-orm/src/pg-core/columns/time.ts
index 9b3ff51e0..b9b52fd79 100644
--- a/drizzle-orm/src/pg-core/columns/time.ts
+++ b/drizzle-orm/src/pg-core/columns/time.ts
@@ -14,7 +14,6 @@ export type PgTimeBuilderInitial = PgTimeBuilder<{
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgTimeBuilder> extends PgDateColumnBaseBuilder<
diff --git a/drizzle-orm/src/pg-core/columns/timestamp.ts b/drizzle-orm/src/pg-core/columns/timestamp.ts
index 6879106e0..f5a5cb0a6 100644
--- a/drizzle-orm/src/pg-core/columns/timestamp.ts
+++ b/drizzle-orm/src/pg-core/columns/timestamp.ts
@@ -13,7 +13,6 @@ export type PgTimestampBuilderInitial = PgTimestampBuilder
data: Date;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgTimestampBuilder>
@@ -75,7 +74,6 @@ export type PgTimestampStringBuilderInitial = PgTimestampS
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgTimestampStringBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/uuid.ts b/drizzle-orm/src/pg-core/columns/uuid.ts
index d0e5a6830..c8455d372 100644
--- a/drizzle-orm/src/pg-core/columns/uuid.ts
+++ b/drizzle-orm/src/pg-core/columns/uuid.ts
@@ -12,7 +12,6 @@ export type PgUUIDBuilderInitial = PgUUIDBuilder<{
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgUUIDBuilder> extends PgColumnBuilder {
diff --git a/drizzle-orm/src/pg-core/columns/varchar.ts b/drizzle-orm/src/pg-core/columns/varchar.ts
index 78ee0db96..192262bef 100644
--- a/drizzle-orm/src/pg-core/columns/varchar.ts
+++ b/drizzle-orm/src/pg-core/columns/varchar.ts
@@ -12,7 +12,6 @@ export type PgVarcharBuilderInitial;
export class PgVarcharBuilder> extends PgColumnBuilder<
diff --git a/drizzle-orm/src/pg-core/columns/vector_extension/bit.ts b/drizzle-orm/src/pg-core/columns/vector_extension/bit.ts
index 81eea6b2f..f1d692821 100644
--- a/drizzle-orm/src/pg-core/columns/vector_extension/bit.ts
+++ b/drizzle-orm/src/pg-core/columns/vector_extension/bit.ts
@@ -12,7 +12,6 @@ export type PgBinaryVectorBuilderInitial = PgBinaryVectorB
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgBinaryVectorBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/vector_extension/halfvec.ts b/drizzle-orm/src/pg-core/columns/vector_extension/halfvec.ts
index e12d0d22f..1c89e7b60 100644
--- a/drizzle-orm/src/pg-core/columns/vector_extension/halfvec.ts
+++ b/drizzle-orm/src/pg-core/columns/vector_extension/halfvec.ts
@@ -12,7 +12,6 @@ export type PgHalfVectorBuilderInitial = PgHalfVectorBuild
data: number[];
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgHalfVectorBuilder> extends PgColumnBuilder<
diff --git a/drizzle-orm/src/pg-core/columns/vector_extension/sparsevec.ts b/drizzle-orm/src/pg-core/columns/vector_extension/sparsevec.ts
index 3881b338f..4817fa51f 100644
--- a/drizzle-orm/src/pg-core/columns/vector_extension/sparsevec.ts
+++ b/drizzle-orm/src/pg-core/columns/vector_extension/sparsevec.ts
@@ -12,7 +12,6 @@ export type PgSparseVectorBuilderInitial = PgSparseVectorB
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgSparseVectorBuilder>
diff --git a/drizzle-orm/src/pg-core/columns/vector_extension/vector.ts b/drizzle-orm/src/pg-core/columns/vector_extension/vector.ts
index eaac075dc..84fb54964 100644
--- a/drizzle-orm/src/pg-core/columns/vector_extension/vector.ts
+++ b/drizzle-orm/src/pg-core/columns/vector_extension/vector.ts
@@ -12,7 +12,6 @@ export type PgVectorBuilderInitial = PgVectorBuilder<{
data: number[];
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class PgVectorBuilder> extends PgColumnBuilder<
diff --git a/drizzle-orm/src/sql/expressions/conditions.ts b/drizzle-orm/src/sql/expressions/conditions.ts
index ba0e21fbc..7ad1355dd 100644
--- a/drizzle-orm/src/sql/expressions/conditions.ts
+++ b/drizzle-orm/src/sql/expressions/conditions.ts
@@ -526,7 +526,7 @@ export function notBetween(
*
* @see ilike for a case-insensitive version of this condition
*/
-export function like(column: Column, value: string | SQLWrapper): SQL {
+export function like(column: Column | SQL.Aliased | SQL, value: string | SQLWrapper): SQL {
return sql`${column} like ${value}`;
}
@@ -548,7 +548,7 @@ export function like(column: Column, value: string | SQLWrapper): SQL {
* @see like for the inverse condition
* @see notIlike for a case-insensitive version of this condition
*/
-export function notLike(column: Column, value: string | SQLWrapper): SQL {
+export function notLike(column: Column | SQL.Aliased | SQL, value: string | SQLWrapper): SQL {
return sql`${column} not like ${value}`;
}
@@ -571,7 +571,7 @@ export function notLike(column: Column, value: string | SQLWrapper): SQL {
*
* @see like for a case-sensitive version of this condition
*/
-export function ilike(column: Column, value: string | SQLWrapper): SQL {
+export function ilike(column: Column | SQL.Aliased | SQL, value: string | SQLWrapper): SQL {
return sql`${column} ilike ${value}`;
}
@@ -593,7 +593,7 @@ export function ilike(column: Column, value: string | SQLWrapper): SQL {
* @see ilike for the inverse condition
* @see notLike for a case-sensitive version of this condition
*/
-export function notIlike(column: Column, value: string | SQLWrapper): SQL {
+export function notIlike(column: Column | SQL.Aliased | SQL, value: string | SQLWrapper): SQL {
return sql`${column} not ilike ${value}`;
}
diff --git a/drizzle-orm/src/sql/sql.ts b/drizzle-orm/src/sql/sql.ts
index 19185f1bf..234370a85 100644
--- a/drizzle-orm/src/sql/sql.ts
+++ b/drizzle-orm/src/sql/sql.ts
@@ -7,7 +7,7 @@ import { tracer } from '~/tracing.ts';
import { ViewBaseConfig } from '~/view-common.ts';
import type { AnyColumn } from '../column.ts';
import { Column } from '../column.ts';
-import { Table } from '../table.ts';
+import { IsAlias, Table } from '../table.ts';
/**
* This class is used to indicate a primitive param value that is used in `sql` tag.
@@ -192,7 +192,15 @@ export class SQL implements SQLWrapper {
if (_config.invokeSource === 'indexes') {
return { sql: escapeName(columnName), params: [] };
}
- return { sql: escapeName(chunk.table[Table.Symbol.Name]) + '.' + escapeName(columnName), params: [] };
+
+ const schemaName = chunk.table[Table.Symbol.Schema];
+ return {
+ sql: chunk.table[IsAlias] || schemaName === undefined
+ ? escapeName(chunk.table[Table.Symbol.Name]) + '.' + escapeName(columnName)
+ : escapeName(schemaName) + '.' + escapeName(chunk.table[Table.Symbol.Name]) + '.'
+ + escapeName(columnName),
+ params: [],
+ };
}
if (is(chunk, View)) {
diff --git a/drizzle-orm/src/sqlite-core/README.md b/drizzle-orm/src/sqlite-core/README.md
index 6d4ebd8b6..ae5fbe660 100644
--- a/drizzle-orm/src/sqlite-core/README.md
+++ b/drizzle-orm/src/sqlite-core/README.md
@@ -8,7 +8,7 @@
-DrizzleORM is a [tiny](https://twitter.com/_alexblokh/status/1594735880417472512), [blazingly fast](#️-performance-and-prepared-statements) TypeScript ORM library with a [drizzle-kit](#-migrations) CLI companion for automatic SQL migrations generation.
+Drizzle ORM is a [tiny](https://twitter.com/_alexblokh/status/1594735880417472512), [blazingly fast](#️-performance-and-prepared-statements) TypeScript ORM library with a [drizzle-kit](#-migrations) CLI companion for automatic SQL migrations generation.
Here you can find extensive docs for SQLite module.
| Driver | Support | |
@@ -365,7 +365,8 @@ const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));
const result = db.with(sq).select().from(sq).all();
```
-> **Note**: Keep in mind that if you need to select raw `sql` in a WITH subquery and reference that field in other queries, you must add an alias to it:
+> [!NOTE]
+> Keep in mind that if you need to select raw `sql` in a WITH subquery and reference that field in other queries, you must add an alias to it:
```typescript
const sq = db.$with('sq').as(db.select({ name: sql`upper(${users.name})`.as('name') }).from(users));
@@ -582,7 +583,8 @@ db
### Joins
-> **Note**: for in-depth partial select joins documentation, refer to [this page](/docs/joins.md).
+> [!NOTE]
+> For in-depth partial select joins documentation, refer to [this page](/docs/joins.md).
### Many-to-one
@@ -721,7 +723,8 @@ const { sql, params } = query.toSQL();
## Views (WIP)
-> **Warning**: views are currently only implemented on the ORM side. That means you can query the views that already exist in the database, but they won't be added to drizzle-kit migrations or `db push` yet.
+> [!WARNING]
+> views are currently only implemented on the ORM side. That means you can query the views that already exist in the database, but they won't be added to drizzle-kit migrations or `db push` yet.
### Creating a view
@@ -731,7 +734,8 @@ import { sqliteView } from 'drizzle-orm/sqlite-core';
const newYorkers = sqliteView('new_yorkers').as((qb) => qb.select().from(users).where(eq(users.cityId, 1)));
```
-> **Warning**: All the parameters inside the query will be inlined, instead of replaced by `$1`, `$2`, etc.
+> [!WARNING]
+> All the parameters inside the query will be inlined, instead of replaced by `$1`, `$2`, etc.
You can also use the [`queryBuilder` instance](#query-builder) directly instead of passing a callback, if you already have it imported.
@@ -794,8 +798,8 @@ q.all({ name: '%an%' }) // SELECT * FROM customers WHERE name ilike '%an%'
### Automatic SQL migrations generation with drizzle-kit
-[Drizzle Kit](https://www.npmjs.com/package/drizzle-kit) is a CLI migrator tool for Drizzle ORM. It is probably one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input.
-Check out the [docs for Drizzle Kit](https://github.com/drizzle-team/drizzle-kit-mirror)
+[Drizzle Kit](https://www.npmjs.com/package/drizzle-kit) is a CLI migrator tool for Drizzle ORM. It is probably the one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input.
+Check out the [docs for Drizzle Kit](https://github.com/drizzle-team/drizzle-kit-mirror).
For schema file:
diff --git a/drizzle-orm/src/sqlite-core/columns/blob.ts b/drizzle-orm/src/sqlite-core/columns/blob.ts
index 22deb3a84..d9f3fc7c6 100644
--- a/drizzle-orm/src/sqlite-core/columns/blob.ts
+++ b/drizzle-orm/src/sqlite-core/columns/blob.ts
@@ -14,7 +14,6 @@ export type SQLiteBigIntBuilderInitial = SQLiteBigIntBuild
data: bigint;
driverParam: Buffer;
enumValues: undefined;
- generated: undefined;
}>;
export class SQLiteBigIntBuilder>
@@ -57,7 +56,6 @@ export type SQLiteBlobJsonBuilderInitial = SQLiteBlobJsonB
data: unknown;
driverParam: Buffer;
enumValues: undefined;
- generated: undefined;
}>;
export class SQLiteBlobJsonBuilder>
@@ -103,7 +101,6 @@ export type SQLiteBlobBufferBuilderInitial = SQLiteBlobBuf
data: Buffer;
driverParam: Buffer;
enumValues: undefined;
- generated: undefined;
}>;
export class SQLiteBlobBufferBuilder>
diff --git a/drizzle-orm/src/sqlite-core/columns/common.ts b/drizzle-orm/src/sqlite-core/columns/common.ts
index 0fd985537..953e5692d 100644
--- a/drizzle-orm/src/sqlite-core/columns/common.ts
+++ b/drizzle-orm/src/sqlite-core/columns/common.ts
@@ -63,7 +63,9 @@ export abstract class SQLiteColumnBuilder<
return this;
}
- generatedAlwaysAs(as: SQL | T['data'] | (() => SQL), config?: SQLiteGeneratedColumnConfig): HasGenerated {
+ generatedAlwaysAs(as: SQL | T['data'] | (() => SQL), config?: SQLiteGeneratedColumnConfig): HasGenerated {
this.config.generated = {
as,
type: 'always',
diff --git a/drizzle-orm/src/sqlite-core/columns/custom.ts b/drizzle-orm/src/sqlite-core/columns/custom.ts
index 6ece801c5..b23d6442f 100644
--- a/drizzle-orm/src/sqlite-core/columns/custom.ts
+++ b/drizzle-orm/src/sqlite-core/columns/custom.ts
@@ -14,7 +14,6 @@ export type ConvertCustomConfig = SQLiteIntegerBui
data: number;
driverParam: number;
enumValues: undefined;
- generated: undefined;
}>;
export class SQLiteIntegerBuilder>
@@ -103,7 +102,6 @@ export type SQLiteTimestampBuilderInitial = SQLiteTimestam
data: Date;
driverParam: number;
enumValues: undefined;
- generated: undefined;
}>;
export class SQLiteTimestampBuilder>
@@ -165,7 +163,6 @@ export type SQLiteBooleanBuilderInitial = SQLiteBooleanBui
data: boolean;
driverParam: number;
enumValues: undefined;
- generated: undefined;
}>;
export class SQLiteBooleanBuilder>
diff --git a/drizzle-orm/src/sqlite-core/columns/numeric.ts b/drizzle-orm/src/sqlite-core/columns/numeric.ts
index 93dfc4c3d..9505367a2 100644
--- a/drizzle-orm/src/sqlite-core/columns/numeric.ts
+++ b/drizzle-orm/src/sqlite-core/columns/numeric.ts
@@ -11,7 +11,6 @@ export type SQLiteNumericBuilderInitial = SQLiteNumericBui
data: string;
driverParam: string;
enumValues: undefined;
- generated: undefined;
}>;
export class SQLiteNumericBuilder>
diff --git a/drizzle-orm/src/sqlite-core/columns/real.ts b/drizzle-orm/src/sqlite-core/columns/real.ts
index cd7cf5d01..8821eb275 100644
--- a/drizzle-orm/src/sqlite-core/columns/real.ts
+++ b/drizzle-orm/src/sqlite-core/columns/real.ts
@@ -11,7 +11,6 @@ export type SQLiteRealBuilderInitial = SQLiteRealBuilder<{
data: number;
driverParam: number;
enumValues: undefined;
- generated: undefined;
}>;
export class SQLiteRealBuilder>
diff --git a/drizzle-orm/src/sqlite-core/columns/text.ts b/drizzle-orm/src/sqlite-core/columns/text.ts
index 84c71fb20..241eb860d 100644
--- a/drizzle-orm/src/sqlite-core/columns/text.ts
+++ b/drizzle-orm/src/sqlite-core/columns/text.ts
@@ -12,7 +12,6 @@ export type SQLiteTextBuilderInitial;
export class SQLiteTextBuilder> extends SQLiteColumnBuilder<
diff --git a/drizzle-orm/tests/casing/mysql-to-camel.test.ts b/drizzle-orm/tests/casing/mysql-to-camel.test.ts
index 651365485..aa8aa04ee 100644
--- a/drizzle-orm/tests/casing/mysql-to-camel.test.ts
+++ b/drizzle-orm/tests/casing/mysql-to-camel.test.ts
@@ -66,7 +66,7 @@ describe('mysql to snake case', () => {
expect(query.toSQL()).toEqual({
sql:
- "select `users`.`firstName` || ' ' || `users`.`lastName` as `name`, `users`.`AGE` from `users` left join `test`.`developers` on `users`.`id` = `developers`.`userId` order by `users`.`firstName` asc",
+ "select `users`.`firstName` || ' ' || `users`.`lastName` as `name`, `users`.`AGE` from `users` left join `test`.`developers` on `users`.`id` = `test`.`developers`.`userId` order by `users`.`firstName` asc",
params: [],
});
expect(db.dialect.casing.cache).toEqual(cache);
diff --git a/drizzle-orm/tests/casing/mysql-to-snake.test.ts b/drizzle-orm/tests/casing/mysql-to-snake.test.ts
index 8ce65e2f9..60496af22 100644
--- a/drizzle-orm/tests/casing/mysql-to-snake.test.ts
+++ b/drizzle-orm/tests/casing/mysql-to-snake.test.ts
@@ -66,7 +66,7 @@ describe('mysql to snake case', () => {
expect(query.toSQL()).toEqual({
sql:
- "select `users`.`first_name` || ' ' || `users`.`last_name` as `name`, `users`.`AGE` from `users` left join `test`.`developers` on `users`.`id` = `developers`.`user_id` order by `users`.`first_name` asc",
+ "select `users`.`first_name` || ' ' || `users`.`last_name` as `name`, `users`.`AGE` from `users` left join `test`.`developers` on `users`.`id` = `test`.`developers`.`user_id` order by `users`.`first_name` asc",
params: [],
});
expect(db.dialect.casing.cache).toEqual(cache);
diff --git a/drizzle-orm/tests/casing/pg-to-camel.test.ts b/drizzle-orm/tests/casing/pg-to-camel.test.ts
index 8d4420403..e325745da 100644
--- a/drizzle-orm/tests/casing/pg-to-camel.test.ts
+++ b/drizzle-orm/tests/casing/pg-to-camel.test.ts
@@ -62,7 +62,7 @@ describe('postgres to camel case', () => {
expect(query.toSQL()).toEqual({
sql:
- 'select "users"."firstName" || \' \' || "users"."lastName" as "name", "users"."AGE" from "users" left join "test"."developers" on "users"."id" = "developers"."userId" order by "users"."firstName" asc',
+ 'select "users"."firstName" || \' \' || "users"."lastName" as "name", "users"."AGE" from "users" left join "test"."developers" on "users"."id" = "test"."developers"."userId" order by "users"."firstName" asc',
params: [],
});
expect(db.dialect.casing.cache).toEqual(cache);
diff --git a/drizzle-orm/tests/casing/pg-to-snake.test.ts b/drizzle-orm/tests/casing/pg-to-snake.test.ts
index 0384e70ca..0c2aeaa27 100644
--- a/drizzle-orm/tests/casing/pg-to-snake.test.ts
+++ b/drizzle-orm/tests/casing/pg-to-snake.test.ts
@@ -62,7 +62,7 @@ describe('postgres to snake case', () => {
expect(query.toSQL()).toEqual({
sql:
- 'select "users"."first_name" || \' \' || "users"."last_name" as "name", "users"."AGE" from "users" left join "test"."developers" on "users"."id" = "developers"."user_id" order by "users"."first_name" asc',
+ 'select "users"."first_name" || \' \' || "users"."last_name" as "name", "users"."AGE" from "users" left join "test"."developers" on "users"."id" = "test"."developers"."user_id" order by "users"."first_name" asc',
params: [],
});
expect(db.dialect.casing.cache).toEqual(cache);
diff --git a/drizzle-orm/type-tests/mysql/generated-columns.ts b/drizzle-orm/type-tests/mysql/generated-columns.ts
index d045fe1b3..56b9d4412 100644
--- a/drizzle-orm/type-tests/mysql/generated-columns.ts
+++ b/drizzle-orm/type-tests/mysql/generated-columns.ts
@@ -17,6 +17,7 @@ const users = mysqlTable(
).$type(), // There is no way for drizzle to detect nullability in these cases. This is how the user can work around it
},
);
+
{
type User = typeof users.$inferSelect;
type NewUser = typeof users.$inferInsert;
diff --git a/drizzle-orm/type-tests/mysql/with.ts b/drizzle-orm/type-tests/mysql/with.ts
index b4e528191..e6f240489 100644
--- a/drizzle-orm/type-tests/mysql/with.ts
+++ b/drizzle-orm/type-tests/mysql/with.ts
@@ -1,6 +1,6 @@
import type { Equal } from 'type-tests/utils.ts';
import { Expect } from 'type-tests/utils.ts';
-import { gt, inArray } from '~/expressions.ts';
+import { gt, inArray, like } from '~/expressions.ts';
import { int, mysqlTable, serial, text } from '~/mysql-core/index.ts';
import { sql } from '~/sql/sql.ts';
import { db } from './db.ts';
@@ -77,4 +77,7 @@ const orders = mysqlTable('orders', {
generated: string | null;
}[], typeof allFromWith>
>;
+
+ const regionalSalesWith = db.$with('regional_sales_with').as(db.select().from(regionalSales));
+ db.with(regionalSalesWith).select().from(regionalSalesWith).where(like(regionalSalesWith.totalSales, 'abc'));
}
diff --git a/drizzle-orm/type-tests/pg/with.ts b/drizzle-orm/type-tests/pg/with.ts
index d5fcc96ed..288e3b6d0 100644
--- a/drizzle-orm/type-tests/pg/with.ts
+++ b/drizzle-orm/type-tests/pg/with.ts
@@ -1,6 +1,6 @@
import type { Equal } from 'type-tests/utils.ts';
import { Expect } from 'type-tests/utils.ts';
-import { gt, inArray } from '~/expressions.ts';
+import { gt, inArray, like } from '~/expressions.ts';
import { integer, pgTable, serial, text } from '~/pg-core/index.ts';
import { sql } from '~/sql/sql.ts';
import { db } from './db.ts';
@@ -77,4 +77,7 @@ const orders = pgTable('orders', {
generated: string | null;
}[], typeof allFromWith>
>;
+
+ const regionalSalesWith = db.$with('regional_sales_with').as(db.select().from(regionalSales));
+ db.with(regionalSalesWith).select().from(regionalSalesWith).where(like(regionalSalesWith.totalSales, 'abc'));
}
diff --git a/drizzle-orm/type-tests/sqlite/generated-columns.ts b/drizzle-orm/type-tests/sqlite/generated-columns.ts
index 57ffea989..f1474baed 100644
--- a/drizzle-orm/type-tests/sqlite/generated-columns.ts
+++ b/drizzle-orm/type-tests/sqlite/generated-columns.ts
@@ -11,12 +11,14 @@ const users = sqliteTable(
firstName: text('first_name', { length: 255 }),
lastName: text('last_name', { length: 255 }),
email: text('email').notNull(),
- fullName: text('full_name').generatedAlwaysAs(sql`concat_ws(first_name, ' ', last_name)`),
+ fullName: text('full_name')
+ .generatedAlwaysAs(sql`concat_ws(first_name, ' ', last_name)`),
upperName: text('upper_name').generatedAlwaysAs(
sql` case when first_name is null then null else upper(first_name) end `,
).$type(), // There is no way for drizzle to detect nullability in these cases. This is how the user can work around it
},
);
+
{
type User = typeof users.$inferSelect;
type NewUser = typeof users.$inferInsert;
diff --git a/drizzle-orm/type-tests/sqlite/with.ts b/drizzle-orm/type-tests/sqlite/with.ts
index 8b5963eb6..b26e4e7d7 100644
--- a/drizzle-orm/type-tests/sqlite/with.ts
+++ b/drizzle-orm/type-tests/sqlite/with.ts
@@ -1,6 +1,6 @@
import type { Equal } from 'type-tests/utils.ts';
import { Expect } from 'type-tests/utils.ts';
-import { gt, inArray } from '~/expressions.ts';
+import { gt, inArray, like } from '~/expressions.ts';
import { sql } from '~/sql/sql.ts';
import { integer, sqliteTable, text } from '~/sqlite-core/index.ts';
import { db } from './db.ts';
@@ -78,4 +78,7 @@ const orders = sqliteTable('orders', {
generated: string | null;
}[], typeof allFromWith>
>;
+
+ const regionalSalesWith = db.$with('regional_sales_with').as(db.select().from(regionalSales));
+ db.with(regionalSalesWith).select().from(regionalSalesWith).where(like(regionalSalesWith.totalSales, 'abc'));
}
diff --git a/examples/mysql-proxy/README.md b/examples/mysql-proxy/README.md
index 8bbdf3f7b..fadc843d3 100644
--- a/examples/mysql-proxy/README.md
+++ b/examples/mysql-proxy/README.md
@@ -30,7 +30,7 @@ This project has simple example of defining http proxy server, that will proxy a
-> **Warning**:
+> [!WARNING]
> You will be responsible for proper error handling in this part. Drizzle always waits for `{rows: string[][] | object[]}` so if any error was on http call(or any other call) - be sure, that you return at least empty array back
>
> For `all` method you should return `{rows: string[][]}`
@@ -72,7 +72,7 @@ In current MySQL Proxy version - drizzle don't handle transactions for migration
-> **Warning**:
+> [!WARNING]
> You will be responsible for proper error handling in this part. Drizzle just finds migrations, that need to be executed on this iteration and if finds some -> provide `queries` array to callback
@@ -97,7 +97,7 @@ await migrate(db, async (queries) => {
---
-> **Note**:
+> [!WARNING]
> It's just a suggestion on how proxy server could be set up and a simple example of params handling on `query` and `migration` calls
```typescript
diff --git a/examples/neon-cloudflare/readme.md b/examples/neon-cloudflare/readme.md
index 0585ccecc..f69581b21 100644
--- a/examples/neon-cloudflare/readme.md
+++ b/examples/neon-cloudflare/readme.md
@@ -1,4 +1,4 @@
-### Example project for [DrizzleORM](https://driz.li/orm) + [Cloudflare Worker](https://workers.cloudflare.com) + [Neon Serverless](https://github.com/neondatabase/serverless)
+### Example project for [Drizzle ORM](https://driz.li/orm) + [Cloudflare Worker](https://workers.cloudflare.com) + [Neon Serverless](https://github.com/neondatabase/serverless)
---
diff --git a/examples/pg-proxy/README.md b/examples/pg-proxy/README.md
index d9ff24fb1..b47fcd5e3 100644
--- a/examples/pg-proxy/README.md
+++ b/examples/pg-proxy/README.md
@@ -30,7 +30,7 @@ This project has simple example of defining http proxy server, that will proxy a
-> **Warning**:
+> [!WARNING]
> You will be responsible for proper error handling in this part. Drizzle always waits for `{rows: string[][] | object[]}` so if any error was on http call(or any other call) - be sure, that you return at least empty array back
>
> For `all` method you should return `{rows: string[][]}`
@@ -72,7 +72,7 @@ In current Postgres Proxy version - drizzle don't handle transactions for migrat
-> **Warning**:
+> [!WARNING]
> You will be responsible for proper error handling in this part. Drizzle just finds migrations, that need to be executed on this iteration and if finds some -> provide `queries` array to callback
@@ -97,7 +97,7 @@ await migrate(db, async (queries) => {
---
-> **Note**:
+> [!NOTE]
> It's just a suggestion on how proxy server could be set up and a simple example of params handling on `query` and `migration` calls
```typescript
diff --git a/examples/sqlite-proxy/README.md b/examples/sqlite-proxy/README.md
index b187e35fb..d25cd7d8b 100644
--- a/examples/sqlite-proxy/README.md
+++ b/examples/sqlite-proxy/README.md
@@ -30,7 +30,7 @@ This project has simple example of defining http proxy server, that will proxy a
-> **Warning**:
+> [!WARNING]
> You will be responsible for proper error handling in this part. Drizzle always waits for `{rows: string[][]}` so if any error was on http call(or any other call) - be sure, that you return at least empty array back
>
> For `get` method you should return `{rows: string[]}`
@@ -71,7 +71,7 @@ In current SQLite Proxy version - drizzle don't handle transactions for migratio
-> **Warning**:
+> [!WARNING]
> You will be responsible for proper error handling in this part. Drizzle just finds migrations, that need to be executed on this iteration and if finds some -> provide `queries` array to callback
@@ -96,7 +96,7 @@ await migrate(db, async (queries) => {
---
-> **Note**:
+> [!NOTE]
> It's just a suggestion on how proxy server could be set up and a simple example of params handling on `query` and `migration` calls
```typescript
diff --git a/integration-tests/tests/mysql/mysql-common.ts b/integration-tests/tests/mysql/mysql-common.ts
index 5dde42934..e2695d767 100644
--- a/integration-tests/tests/mysql/mysql-common.ts
+++ b/integration-tests/tests/mysql/mysql-common.ts
@@ -3416,7 +3416,7 @@ export function tests(driver?: string) {
expect(query).toEqual({
sql:
- `select \`id\`, \`name\` from \`mySchema\`.\`userstest\` group by \`userstest\`.\`id\`, \`userstest\`.\`name\``,
+ `select \`id\`, \`name\` from \`mySchema\`.\`userstest\` group by \`mySchema\`.\`userstest\`.\`id\`, \`mySchema\`.\`userstest\`.\`name\``,
params: [],
});
});
@@ -3506,6 +3506,23 @@ export function tests(driver?: string) {
expect(result).toStrictEqual([{ id: 1 }]);
});
+ test('insert $returningId: serial as id, not first column', async (ctx) => {
+ const { db } = ctx.mysql;
+
+ const usersTableDefNotFirstColumn = mysqlTable('users2', {
+ name: text('name').notNull(),
+ id: serial('id').primaryKey(),
+ });
+
+ const result = await db.insert(usersTableDefNotFirstColumn).values({ name: 'John' }).$returningId();
+
+ expectTypeOf(result).toEqualTypeOf<{
+ id: number;
+ }[]>();
+
+ expect(result).toStrictEqual([{ id: 1 }]);
+ });
+
test('insert $returningId: serial as id, batch insert', async (ctx) => {
const { db } = ctx.mysql;
diff --git a/integration-tests/tests/pg/pg-common.ts b/integration-tests/tests/pg/pg-common.ts
index c7f4b9be7..dd2971c3c 100644
--- a/integration-tests/tests/pg/pg-common.ts
+++ b/integration-tests/tests/pg/pg-common.ts
@@ -4278,7 +4278,7 @@ export function tests() {
.toSQL();
expect(query).toEqual({
- sql: 'select "id", "name" from "mySchema"."users" group by "users"."id", "users"."name"',
+ sql: 'select "id", "name" from "mySchema"."users" group by "mySchema"."users"."id", "mySchema"."users"."name"',
params: [],
});
});
diff --git a/package.json b/package.json
index 29189a91b..d52a568a6 100755
--- a/package.json
+++ b/package.json
@@ -1,4 +1,5 @@
{
+ "name": "drizzle-root",
"private": true,
"scripts": {
"build:orm": "turbo run build --filter drizzle-orm --color",
@@ -34,7 +35,7 @@
"resolve-tspaths": "^0.8.16",
"tsup": "^7.2.0",
"tsx": "^4.10.5",
- "turbo": "^1.10.14",
+ "turbo": "^2.2.3",
"typescript": "5.6.3"
},
"packageManager": "pnpm@9.7.0"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 468f12ca6..759aad057 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -40,7 +40,7 @@ importers:
version: link:drizzle-orm/dist
drizzle-orm-old:
specifier: npm:drizzle-orm@^0.27.2
- version: drizzle-orm@0.27.2(@aws-sdk/client-rds-data@3.583.0)(@cloudflare/workers-types@4.20241004.0)(@libsql/client@0.10.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(@neondatabase/serverless@0.9.3)(@opentelemetry/api@1.8.0)(@planetscale/database@1.18.0)(@types/better-sqlite3@7.6.10)(@types/pg@8.11.6)(@types/sql.js@1.4.9)(@vercel/postgres@0.8.0)(better-sqlite3@9.6.0)(bun-types@1.0.3)(knex@2.5.1(better-sqlite3@9.6.0)(mysql2@3.11.0)(pg@8.11.5)(sqlite3@5.1.7))(kysely@0.25.0)(mysql2@3.11.0)(pg@8.11.5)(postgres@3.4.4)(sql.js@1.10.3)(sqlite3@5.1.7)
+ version: drizzle-orm@0.27.2(@aws-sdk/client-rds-data@3.583.0)(@cloudflare/workers-types@4.20241004.0)(@libsql/client@0.10.0)(@neondatabase/serverless@0.9.3)(@opentelemetry/api@1.8.0)(@planetscale/database@1.18.0)(@types/better-sqlite3@7.6.10)(@types/pg@8.11.6)(@types/sql.js@1.4.9)(@vercel/postgres@0.8.0)(better-sqlite3@9.6.0)(bun-types@1.0.3)(knex@2.5.1(better-sqlite3@9.6.0)(mysql2@3.11.0)(pg@8.11.5)(sqlite3@5.1.7))(kysely@0.25.0)(mysql2@3.11.0)(pg@8.11.5)(postgres@3.4.4)(sql.js@1.10.3)(sqlite3@5.1.7)
eslint:
specifier: ^8.50.0
version: 8.50.0
@@ -73,13 +73,13 @@ importers:
version: 0.8.16(typescript@5.6.3)
tsup:
specifier: ^7.2.0
- version: 7.2.0(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.12.12)(typescript@5.6.3))(typescript@5.6.3)
+ version: 7.2.0(postcss@8.4.39)(ts-node@10.9.2(typescript@5.6.3))(typescript@5.6.3)
tsx:
specifier: ^4.10.5
version: 4.10.5
turbo:
- specifier: ^1.10.14
- version: 1.10.14
+ specifier: ^2.2.3
+ version: 2.2.3
typescript:
specifier: 5.6.3
version: 5.6.3
@@ -370,8 +370,8 @@ importers:
specifier: ^10.1.0
version: 10.1.0
expo-sqlite:
- specifier: ^13.2.0
- version: 13.4.0(expo@51.0.8(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(bufferutil@4.0.8)(encoding@0.1.13))
+ specifier: ^14.0.0
+ version: 14.0.6(expo@51.0.8(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(bufferutil@4.0.8)(encoding@0.1.13))
knex:
specifier: ^2.4.2
version: 2.5.1(better-sqlite3@8.7.0)(mysql2@3.3.3)(pg@8.11.5)(sqlite3@5.1.7)
@@ -6127,8 +6127,8 @@ packages:
expo-modules-core@1.12.11:
resolution: {integrity: sha512-CF5G6hZo/6uIUz6tj4dNRlvE5L4lakYukXPqz5ZHQ+6fLk1NQVZbRdpHjMkxO/QSBQcKUzG/ngeytpoJus7poQ==}
- expo-sqlite@13.4.0:
- resolution: {integrity: sha512-5f7d2EDM+pgerM33KndtX4gWw2nuVaXY68nnqx7PhkiYeyEmeNfZ29bIFtpBzNb/L5l0/DTtRxuSqftxbknFtw==}
+ expo-sqlite@14.0.6:
+ resolution: {integrity: sha512-T3YNx7LT7lM4UQRgi8ml+cj0Wf3Ep09+B4CVaWtUCjdyYJIZjsHDT65hypKG+r6btTLLEd11hjlrstNQhzt5gQ==}
peerDependencies:
expo: '*'
@@ -7184,12 +7184,10 @@ packages:
libsql@0.3.19:
resolution: {integrity: sha512-Aj5cQ5uk/6fHdmeW0TiXK42FqUlwx7ytmMLPSaUQPin5HKKKuUPD62MAbN4OEweGBBI7q1BekoEN4gPUEL6MZA==}
- cpu: [x64, arm64, wasm32]
os: [darwin, linux, win32]
libsql@0.4.1:
resolution: {integrity: sha512-qZlR9Yu1zMBeLChzkE/cKfoKV3Esp9cn9Vx5Zirn4AVhDWPcjYhKwbtJcMuHehgk3mH+fJr9qW+3vesBWbQpBg==}
- cpu: [x64, arm64, wasm32]
os: [darwin, linux, win32]
lighthouse-logger@1.4.2:
@@ -9491,38 +9489,38 @@ packages:
tunnel-agent@0.6.0:
resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==}
- turbo-darwin-64@1.10.14:
- resolution: {integrity: sha512-I8RtFk1b9UILAExPdG/XRgGQz95nmXPE7OiGb6ytjtNIR5/UZBS/xVX/7HYpCdmfriKdVwBKhalCoV4oDvAGEg==}
+ turbo-darwin-64@2.2.3:
+ resolution: {integrity: sha512-Rcm10CuMKQGcdIBS3R/9PMeuYnv6beYIHqfZFeKWVYEWH69sauj4INs83zKMTUiZJ3/hWGZ4jet9AOwhsssLyg==}
cpu: [x64]
os: [darwin]
- turbo-darwin-arm64@1.10.14:
- resolution: {integrity: sha512-KAdUWryJi/XX7OD0alOuOa0aJ5TLyd4DNIYkHPHYcM6/d7YAovYvxRNwmx9iv6Vx6IkzTnLeTiUB8zy69QkG9Q==}
+ turbo-darwin-arm64@2.2.3:
+ resolution: {integrity: sha512-+EIMHkuLFqUdJYsA3roj66t9+9IciCajgj+DVek+QezEdOJKcRxlvDOS2BUaeN8kEzVSsNiAGnoysFWYw4K0HA==}
cpu: [arm64]
os: [darwin]
- turbo-linux-64@1.10.14:
- resolution: {integrity: sha512-BOBzoREC2u4Vgpap/WDxM6wETVqVMRcM8OZw4hWzqCj2bqbQ6L0wxs1LCLWVrghQf93JBQtIGAdFFLyCSBXjWQ==}
+ turbo-linux-64@2.2.3:
+ resolution: {integrity: sha512-UBhJCYnqtaeOBQLmLo8BAisWbc9v9daL9G8upLR+XGj6vuN/Nz6qUAhverN4Pyej1g4Nt1BhROnj6GLOPYyqxQ==}
cpu: [x64]
os: [linux]
- turbo-linux-arm64@1.10.14:
- resolution: {integrity: sha512-D8T6XxoTdN5D4V5qE2VZG+/lbZX/89BkAEHzXcsSUTRjrwfMepT3d2z8aT6hxv4yu8EDdooZq/2Bn/vjMI32xw==}
+ turbo-linux-arm64@2.2.3:
+ resolution: {integrity: sha512-hJYT9dN06XCQ3jBka/EWvvAETnHRs3xuO/rb5bESmDfG+d9yQjeTMlhRXKrr4eyIMt6cLDt1LBfyi+6CQ+VAwQ==}
cpu: [arm64]
os: [linux]
- turbo-windows-64@1.10.14:
- resolution: {integrity: sha512-zKNS3c1w4i6432N0cexZ20r/aIhV62g69opUn82FLVs/zk3Ie0GVkSB6h0rqIvMalCp7enIR87LkPSDGz9K4UA==}
+ turbo-windows-64@2.2.3:
+ resolution: {integrity: sha512-NPrjacrZypMBF31b4HE4ROg4P3nhMBPHKS5WTpMwf7wydZ8uvdEHpESVNMOtqhlp857zbnKYgP+yJF30H3N2dQ==}
cpu: [x64]
os: [win32]
- turbo-windows-arm64@1.10.14:
- resolution: {integrity: sha512-rkBwrTPTxNSOUF7of8eVvvM+BkfkhA2OvpHM94if8tVsU+khrjglilp8MTVPHlyS9byfemPAmFN90oRIPB05BA==}
+ turbo-windows-arm64@2.2.3:
+ resolution: {integrity: sha512-fnNrYBCqn6zgKPKLHu4sOkihBI/+0oYFr075duRxqUZ+1aLWTAGfHZLgjVeLh3zR37CVzuerGIPWAEkNhkWEIw==}
cpu: [arm64]
os: [win32]
- turbo@1.10.14:
- resolution: {integrity: sha512-hr9wDNYcsee+vLkCDIm8qTtwhJ6+UAMJc3nIY6+PNgUTtXcQgHxCq8BGoL7gbABvNWv76CNbK5qL4Lp9G3ZYRA==}
+ turbo@2.2.3:
+ resolution: {integrity: sha512-5lDvSqIxCYJ/BAd6rQGK/AzFRhBkbu4JHVMLmGh/hCb7U3CqSnr5Tjwfy9vc+/5wG2DJ6wttgAaA7MoCgvBKZQ==}
hasBin: true
tweetnacl@0.14.5:
@@ -10271,7 +10269,7 @@ snapshots:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
'@aws-sdk/client-sso-oidc': 3.569.0
- '@aws-sdk/client-sts': 3.569.0(@aws-sdk/client-sso-oidc@3.569.0)
+ '@aws-sdk/client-sts': 3.569.0
'@aws-sdk/core': 3.567.0
'@aws-sdk/credential-provider-node': 3.569.0(@aws-sdk/client-sso-oidc@3.569.0)(@aws-sdk/client-sts@3.569.0)
'@aws-sdk/middleware-host-header': 3.567.0
@@ -10412,7 +10410,7 @@ snapshots:
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
- '@aws-sdk/client-sts': 3.569.0(@aws-sdk/client-sso-oidc@3.569.0)
+ '@aws-sdk/client-sts': 3.569.0
'@aws-sdk/core': 3.567.0
'@aws-sdk/credential-provider-node': 3.569.0(@aws-sdk/client-sso-oidc@3.569.0)(@aws-sdk/client-sts@3.569.0)
'@aws-sdk/middleware-host-header': 3.567.0
@@ -10672,7 +10670,7 @@ snapshots:
transitivePeerDependencies:
- aws-crt
- '@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0)':
+ '@aws-sdk/client-sts@3.569.0':
dependencies:
'@aws-crypto/sha256-browser': 3.0.0
'@aws-crypto/sha256-js': 3.0.0
@@ -10714,6 +10712,51 @@ snapshots:
'@smithy/util-retry': 2.2.0
'@smithy/util-utf8': 2.3.0
tslib: 2.6.2
+ transitivePeerDependencies:
+ - aws-crt
+
+ '@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0)':
+ dependencies:
+ '@aws-crypto/sha256-browser': 3.0.0
+ '@aws-crypto/sha256-js': 3.0.0
+ '@aws-sdk/client-sso-oidc': 3.569.0
+ '@aws-sdk/core': 3.567.0
+ '@aws-sdk/credential-provider-node': 3.569.0(@aws-sdk/client-sso-oidc@3.569.0)(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))
+ '@aws-sdk/middleware-host-header': 3.567.0
+ '@aws-sdk/middleware-logger': 3.568.0
+ '@aws-sdk/middleware-recursion-detection': 3.567.0
+ '@aws-sdk/middleware-user-agent': 3.567.0
+ '@aws-sdk/region-config-resolver': 3.567.0
+ '@aws-sdk/types': 3.567.0
+ '@aws-sdk/util-endpoints': 3.567.0
+ '@aws-sdk/util-user-agent-browser': 3.567.0
+ '@aws-sdk/util-user-agent-node': 3.568.0
+ '@smithy/config-resolver': 2.2.0
+ '@smithy/core': 1.4.2
+ '@smithy/fetch-http-handler': 2.5.0
+ '@smithy/hash-node': 2.2.0
+ '@smithy/invalid-dependency': 2.2.0
+ '@smithy/middleware-content-length': 2.2.0
+ '@smithy/middleware-endpoint': 2.5.1
+ '@smithy/middleware-retry': 2.3.1
+ '@smithy/middleware-serde': 2.3.0
+ '@smithy/middleware-stack': 2.2.0
+ '@smithy/node-config-provider': 2.3.0
+ '@smithy/node-http-handler': 2.5.0
+ '@smithy/protocol-http': 3.3.0
+ '@smithy/smithy-client': 2.5.1
+ '@smithy/types': 2.12.0
+ '@smithy/url-parser': 2.2.0
+ '@smithy/util-base64': 2.3.0
+ '@smithy/util-body-length-browser': 2.2.0
+ '@smithy/util-body-length-node': 2.3.0
+ '@smithy/util-defaults-mode-browser': 2.2.1
+ '@smithy/util-defaults-mode-node': 2.3.1
+ '@smithy/util-endpoints': 1.2.0
+ '@smithy/util-middleware': 2.2.0
+ '@smithy/util-retry': 2.2.0
+ '@smithy/util-utf8': 2.3.0
+ tslib: 2.6.2
transitivePeerDependencies:
- '@aws-sdk/client-sso-oidc'
- aws-crt
@@ -10862,6 +10905,23 @@ snapshots:
transitivePeerDependencies:
- aws-crt
+ '@aws-sdk/credential-provider-ini@3.568.0(@aws-sdk/client-sso-oidc@3.569.0)(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))':
+ dependencies:
+ '@aws-sdk/client-sts': 3.569.0(@aws-sdk/client-sso-oidc@3.569.0)
+ '@aws-sdk/credential-provider-env': 3.568.0
+ '@aws-sdk/credential-provider-process': 3.568.0
+ '@aws-sdk/credential-provider-sso': 3.568.0(@aws-sdk/client-sso-oidc@3.569.0)
+ '@aws-sdk/credential-provider-web-identity': 3.568.0(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))
+ '@aws-sdk/types': 3.567.0
+ '@smithy/credential-provider-imds': 2.3.0
+ '@smithy/property-provider': 2.2.0
+ '@smithy/shared-ini-file-loader': 2.4.0
+ '@smithy/types': 2.12.0
+ tslib: 2.6.2
+ transitivePeerDependencies:
+ - '@aws-sdk/client-sso-oidc'
+ - aws-crt
+
'@aws-sdk/credential-provider-ini@3.568.0(@aws-sdk/client-sso-oidc@3.569.0)(@aws-sdk/client-sts@3.569.0)':
dependencies:
'@aws-sdk/client-sts': 3.569.0(@aws-sdk/client-sso-oidc@3.569.0)
@@ -10885,7 +10945,7 @@ snapshots:
'@aws-sdk/credential-provider-env': 3.568.0
'@aws-sdk/credential-provider-process': 3.568.0
'@aws-sdk/credential-provider-sso': 3.568.0(@aws-sdk/client-sso-oidc@3.583.0)
- '@aws-sdk/credential-provider-web-identity': 3.568.0(@aws-sdk/client-sts@3.569.0)
+ '@aws-sdk/credential-provider-web-identity': 3.568.0(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))
'@aws-sdk/types': 3.567.0
'@smithy/credential-provider-imds': 2.3.0
'@smithy/property-provider': 2.2.0
@@ -10929,6 +10989,25 @@ snapshots:
transitivePeerDependencies:
- aws-crt
+ '@aws-sdk/credential-provider-node@3.569.0(@aws-sdk/client-sso-oidc@3.569.0)(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))':
+ dependencies:
+ '@aws-sdk/credential-provider-env': 3.568.0
+ '@aws-sdk/credential-provider-http': 3.568.0
+ '@aws-sdk/credential-provider-ini': 3.568.0(@aws-sdk/client-sso-oidc@3.569.0)(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))
+ '@aws-sdk/credential-provider-process': 3.568.0
+ '@aws-sdk/credential-provider-sso': 3.568.0(@aws-sdk/client-sso-oidc@3.569.0)
+ '@aws-sdk/credential-provider-web-identity': 3.568.0(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))
+ '@aws-sdk/types': 3.567.0
+ '@smithy/credential-provider-imds': 2.3.0
+ '@smithy/property-provider': 2.2.0
+ '@smithy/shared-ini-file-loader': 2.4.0
+ '@smithy/types': 2.12.0
+ tslib: 2.6.2
+ transitivePeerDependencies:
+ - '@aws-sdk/client-sso-oidc'
+ - '@aws-sdk/client-sts'
+ - aws-crt
+
'@aws-sdk/credential-provider-node@3.569.0(@aws-sdk/client-sso-oidc@3.569.0)(@aws-sdk/client-sts@3.569.0)':
dependencies:
'@aws-sdk/credential-provider-env': 3.568.0
@@ -10955,7 +11034,7 @@ snapshots:
'@aws-sdk/credential-provider-ini': 3.568.0(@aws-sdk/client-sso-oidc@3.583.0)(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))
'@aws-sdk/credential-provider-process': 3.568.0
'@aws-sdk/credential-provider-sso': 3.568.0(@aws-sdk/client-sso-oidc@3.583.0)
- '@aws-sdk/credential-provider-web-identity': 3.568.0(@aws-sdk/client-sts@3.569.0)
+ '@aws-sdk/credential-provider-web-identity': 3.568.0(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))
'@aws-sdk/types': 3.567.0
'@smithy/credential-provider-imds': 2.3.0
'@smithy/property-provider': 2.2.0
@@ -11068,7 +11147,7 @@ snapshots:
'@smithy/types': 2.12.0
tslib: 2.6.2
- '@aws-sdk/credential-provider-web-identity@3.568.0(@aws-sdk/client-sts@3.569.0)':
+ '@aws-sdk/credential-provider-web-identity@3.568.0(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))':
dependencies:
'@aws-sdk/client-sts': 3.569.0(@aws-sdk/client-sso-oidc@3.569.0)
'@aws-sdk/types': 3.567.0
@@ -11076,6 +11155,14 @@ snapshots:
'@smithy/types': 2.12.0
tslib: 2.6.2
+ '@aws-sdk/credential-provider-web-identity@3.568.0(@aws-sdk/client-sts@3.569.0)':
+ dependencies:
+ '@aws-sdk/client-sts': 3.569.0
+ '@aws-sdk/types': 3.567.0
+ '@smithy/property-provider': 2.2.0
+ '@smithy/types': 2.12.0
+ tslib: 2.6.2
+
'@aws-sdk/credential-provider-web-identity@3.577.0(@aws-sdk/client-sts@3.583.0)':
dependencies:
'@aws-sdk/client-sts': 3.583.0
@@ -11096,7 +11183,7 @@ snapshots:
'@aws-sdk/credential-provider-node': 3.569.0(@aws-sdk/client-sso-oidc@3.583.0)(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))
'@aws-sdk/credential-provider-process': 3.568.0
'@aws-sdk/credential-provider-sso': 3.568.0(@aws-sdk/client-sso-oidc@3.583.0)
- '@aws-sdk/credential-provider-web-identity': 3.568.0(@aws-sdk/client-sts@3.569.0)
+ '@aws-sdk/credential-provider-web-identity': 3.568.0(@aws-sdk/client-sts@3.569.0(@aws-sdk/client-sso-oidc@3.569.0))
'@aws-sdk/types': 3.567.0
'@smithy/credential-provider-imds': 2.3.0
'@smithy/property-provider': 2.2.0
@@ -16432,7 +16519,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
- drizzle-orm@0.27.2(@aws-sdk/client-rds-data@3.583.0)(@cloudflare/workers-types@4.20241004.0)(@libsql/client@0.10.0(bufferutil@4.0.8)(utf-8-validate@6.0.3))(@neondatabase/serverless@0.9.3)(@opentelemetry/api@1.8.0)(@planetscale/database@1.18.0)(@types/better-sqlite3@7.6.10)(@types/pg@8.11.6)(@types/sql.js@1.4.9)(@vercel/postgres@0.8.0)(better-sqlite3@9.6.0)(bun-types@1.0.3)(knex@2.5.1(better-sqlite3@9.6.0)(mysql2@3.11.0)(pg@8.11.5)(sqlite3@5.1.7))(kysely@0.25.0)(mysql2@3.11.0)(pg@8.11.5)(postgres@3.4.4)(sql.js@1.10.3)(sqlite3@5.1.7):
+ drizzle-orm@0.27.2(@aws-sdk/client-rds-data@3.583.0)(@cloudflare/workers-types@4.20241004.0)(@libsql/client@0.10.0)(@neondatabase/serverless@0.9.3)(@opentelemetry/api@1.8.0)(@planetscale/database@1.18.0)(@types/better-sqlite3@7.6.10)(@types/pg@8.11.6)(@types/sql.js@1.4.9)(@vercel/postgres@0.8.0)(better-sqlite3@9.6.0)(bun-types@1.0.3)(knex@2.5.1(better-sqlite3@9.6.0)(mysql2@3.11.0)(pg@8.11.5)(sqlite3@5.1.7))(kysely@0.25.0)(mysql2@3.11.0)(pg@8.11.5)(postgres@3.4.4)(sql.js@1.10.3)(sqlite3@5.1.7):
optionalDependencies:
'@aws-sdk/client-rds-data': 3.583.0
'@cloudflare/workers-types': 4.20241004.0
@@ -17315,7 +17402,7 @@ snapshots:
dependencies:
invariant: 2.2.4
- expo-sqlite@13.4.0(expo@51.0.8(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(bufferutil@4.0.8)(encoding@0.1.13)):
+ expo-sqlite@14.0.6(expo@51.0.8(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(bufferutil@4.0.8)(encoding@0.1.13)):
dependencies:
'@expo/websql': 1.0.1
expo: 51.0.8(@babel/core@7.24.6)(@babel/preset-env@7.24.6(@babel/core@7.24.6))(bufferutil@4.0.8)(encoding@0.1.13)
@@ -19652,7 +19739,7 @@ snapshots:
possible-typed-array-names@1.0.0: {}
- postcss-load-config@4.0.1(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.12.12)(typescript@5.6.3)):
+ postcss-load-config@4.0.1(postcss@8.4.39)(ts-node@10.9.2(typescript@5.6.3)):
dependencies:
lilconfig: 2.1.0
yaml: 2.3.1
@@ -20923,7 +21010,7 @@ snapshots:
tslib@2.6.2: {}
- tsup@7.2.0(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.12.12)(typescript@5.6.3))(typescript@5.6.3):
+ tsup@7.2.0(postcss@8.4.39)(ts-node@10.9.2(typescript@5.6.3))(typescript@5.6.3):
dependencies:
bundle-require: 4.0.2(esbuild@0.18.20)
cac: 6.7.14
@@ -20933,7 +21020,7 @@ snapshots:
execa: 5.1.1
globby: 11.1.0
joycon: 3.1.1
- postcss-load-config: 4.0.1(postcss@8.4.39)(ts-node@10.9.2(@types/node@20.12.12)(typescript@5.6.3))
+ postcss-load-config: 4.0.1(postcss@8.4.39)(ts-node@10.9.2(typescript@5.6.3))
resolve-from: 5.0.0
rollup: 3.27.2
source-map: 0.8.0-beta.0
@@ -21003,32 +21090,32 @@ snapshots:
dependencies:
safe-buffer: 5.2.1
- turbo-darwin-64@1.10.14:
+ turbo-darwin-64@2.2.3:
optional: true
- turbo-darwin-arm64@1.10.14:
+ turbo-darwin-arm64@2.2.3:
optional: true
- turbo-linux-64@1.10.14:
+ turbo-linux-64@2.2.3:
optional: true
- turbo-linux-arm64@1.10.14:
+ turbo-linux-arm64@2.2.3:
optional: true
- turbo-windows-64@1.10.14:
+ turbo-windows-64@2.2.3:
optional: true
- turbo-windows-arm64@1.10.14:
+ turbo-windows-arm64@2.2.3:
optional: true
- turbo@1.10.14:
+ turbo@2.2.3:
optionalDependencies:
- turbo-darwin-64: 1.10.14
- turbo-darwin-arm64: 1.10.14
- turbo-linux-64: 1.10.14
- turbo-linux-arm64: 1.10.14
- turbo-windows-64: 1.10.14
- turbo-windows-arm64: 1.10.14
+ turbo-darwin-64: 2.2.3
+ turbo-darwin-arm64: 2.2.3
+ turbo-linux-64: 2.2.3
+ turbo-linux-arm64: 2.2.3
+ turbo-windows-64: 2.2.3
+ turbo-windows-arm64: 2.2.3
tweetnacl@0.14.5: {}
diff --git a/turbo.json b/turbo.json
index 3d07b1e88..e978069b2 100644
--- a/turbo.json
+++ b/turbo.json
@@ -1,12 +1,24 @@
{
"$schema": "https://turbo.build/schema.json",
- "pipeline": {
+ "tasks": {
"//#lint": {
- "inputs": ["**/*.ts", "!**/node_modules", "!**/dist", "!**/dist-dts"],
- "outputMode": "new-only"
+ "dependsOn": [
+ "^test:types",
+ "drizzle-orm#build"
+ ],
+ "inputs": [
+ "**/*.ts",
+ "!**/node_modules",
+ "!**/dist",
+ "!**/dist-dts"
+ ],
+ "outputLogs": "new-only"
},
"test:types": {
- "dependsOn": ["^test:types", "^build"],
+ "dependsOn": [
+ "^test:types",
+ "drizzle-orm#build"
+ ],
"inputs": [
"src/**/*.ts",
"tests/**/*.ts",
@@ -14,10 +26,119 @@
"tests/tsconfig.json",
"../tsconfig.json"
],
- "outputMode": "new-only"
+ "outputLogs": "new-only"
+ },
+ "drizzle-orm#build": {
+ "inputs": [
+ "src/**/*.ts",
+ "package.json",
+ "README.md",
+ "../README.md",
+ "tsconfig.json",
+ "tsconfig.*.json",
+ "tsup.config.ts",
+ "scripts/build.ts",
+ "scripts/fix-imports.ts",
+ "../tsconfig.json"
+ ],
+ "outputs": [
+ "dist/**",
+ "dist-dts/**"
+ ],
+ "outputLogs": "new-only"
+ },
+ "drizzle-kit#build": {
+ "dependsOn": [
+ "drizzle-orm#build"
+ ],
+ "inputs": [
+ "src/**/*.ts",
+ "package.json",
+ "README.md",
+ "../README.md",
+ "tsconfig.json",
+ "tsconfig.*.json",
+ "tsup.config.ts",
+ "scripts/build.ts",
+ "scripts/fix-imports.ts",
+ "../tsconfig.json"
+ ],
+ "outputs": [
+ "dist/**",
+ "dist-dts/**"
+ ],
+ "outputLogs": "new-only"
+ },
+ "drizzle-zod#build": {
+ "dependsOn": [
+ "drizzle-orm#build"
+ ],
+ "inputs": [
+ "src/**/*.ts",
+ "package.json",
+ "README.md",
+ "../README.md",
+ "tsconfig.json",
+ "tsconfig.*.json",
+ "tsup.config.ts",
+ "scripts/build.ts",
+ "scripts/fix-imports.ts",
+ "../tsconfig.json"
+ ],
+ "outputs": [
+ "dist/**",
+ "dist-dts/**"
+ ],
+ "outputLogs": "new-only"
+ },
+ "drizzle-typebox#build": {
+ "dependsOn": [
+ "drizzle-orm#build"
+ ],
+ "inputs": [
+ "src/**/*.ts",
+ "package.json",
+ "README.md",
+ "../README.md",
+ "tsconfig.json",
+ "tsconfig.*.json",
+ "tsup.config.ts",
+ "scripts/build.ts",
+ "scripts/fix-imports.ts",
+ "../tsconfig.json"
+ ],
+ "outputs": [
+ "dist/**",
+ "dist-dts/**"
+ ],
+ "outputLogs": "new-only"
+ },
+ "drizzle-valibot#build": {
+ "dependsOn": [
+ "drizzle-orm#build"
+ ],
+ "inputs": [
+ "src/**/*.ts",
+ "package.json",
+ "README.md",
+ "../README.md",
+ "tsconfig.json",
+ "tsconfig.*.json",
+ "tsup.config.ts",
+ "scripts/build.ts",
+ "scripts/fix-imports.ts",
+ "../tsconfig.json"
+ ],
+ "outputs": [
+ "dist/**",
+ "dist-dts/**"
+ ],
+ "outputLogs": "new-only"
},
- "build": {
- "dependsOn": ["^build"],
+ "eslint-plugin-drizzle#build": {
+ "dependsOn": [
+ "drizzle-orm#build"
+ ],
"inputs": [
"src/**/*.ts",
"package.json",
@@ -30,23 +151,58 @@
"scripts/fix-imports.ts",
"../tsconfig.json"
],
- "outputs": ["dist/**", "dist-dts/**"],
- "outputMode": "new-only"
+ "outputs": [
+ "dist/**",
+ "dist-dts/**"
+ ],
+ "outputLogs": "new-only"
+ },
+ "integration-tests#build": {
+ "dependsOn": [
+ "drizzle-orm#build"
+ ],
+ "inputs": [
+ "src/**/*.ts",
+ "package.json",
+ "README.md",
+ "../README.md",
+ "tsconfig.json",
+ "tsconfig.*.json",
+ "tsup.config.ts",
+ "scripts/build.ts",
+ "scripts/fix-imports.ts",
+ "../tsconfig.json"
+ ],
+ "outputs": [
+ "dist/**",
+ "dist-dts/**"
+ ],
+ "outputLogs": "new-only"
},
"pack": {
- "dependsOn": ["build", "test:types"],
- "inputs": ["dist/**"],
- "outputs": ["package.tgz"],
- "outputMode": "new-only"
+ "dependsOn": [
+ "build",
+ "test:types"
+ ],
+ "inputs": [
+ "dist/**"
+ ],
+ "outputs": [
+ "package.tgz"
+ ],
+ "outputLogs": "new-only"
},
"test": {
- "dependsOn": ["build", "test:types"],
+ "dependsOn": [
+ "build",
+ "test:types"
+ ],
"inputs": [
"tests/**/*.test.ts",
"tests/**/*.test.cjs",
"tests/**/*.test.mjs"
],
- "outputMode": "new-only"
+ "outputLogs": "new-only"
}
}
}