Repository navigation
rc5 fixes - #6588
Open
Sukairo-02 wants to merge 84 commits into
Open
rc5 fixes#6588Sukairo-02 wants to merge 84 commits into
Sukairo-02 wants to merge 84 commits into
Conversation
… codecs; column type fixes: `enum` from objects, wrong `dataType` of certain columns, `is` casting columns to `never`; fixed codecs for empty array in `effect-postgres`
1 task done
…acks keep their types Without a default, calling createSchemaFactory() without a `coerce` option left TCoerce at its CoerceOptions constraint, which distributes through the refine field types into a union of incompatible callbacks, so `(schema) => ...` refines became implicit any. Default to `undefined`, matching the top-level createSelectSchema/createInsertSchema exports. Fixes #5968
…`, `number` value cases for `bun-sql/postgres`, `postgres-js`, `node-postgres` driver; extended `all types` tests with JSON suites
…`JSON.stringify(value) json codec for `node-postgres` (same functionality)
PgPolicy, PgRole, CockroachPolicy and CockroachRole declared `implements <X>Config` while typing their fields as `<X>Config['field']`, which includes `undefined`. Consumers that type-check the published declarations with `exactOptionalPropertyTypes: true` and `skipLibCheck: false` get TS2420 for each class, because a present `undefined` is not assignable to an exact optional property. The clauses only asserted a structural relationship; removing them keeps every public field type unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… to `^` instead of `>=`
Remove the external-database guard from the PostgreSQL shard in both feature workflows. Hosted providers remain excluded by the test script and Vitest configuration.
The `created_at` checks compared the stored time with `Date.now()` from before the insert and allowed 300 ms. The tests run concurrently, so an insert can wait for another test. On CI the aurora test failed with a difference of about 1.5 s in most runs. `expectRecentTime` checks that the time lies between the start of the statement and now, with the same margin for clocks that differ. It replaces the 16 checks with a 300 ms or 1 s margin in the shared pg, cockroach, mysql and sqlite test bodies. The sweep over all 793 entry points in `exports-resolution.test.ts` takes 55 to 77 s on CI and took 153 s on a slow runner. Its limit goes from 120 s to 300 s.
The skip list named the test without its `test ` prefix. The test runner compares whole names, so the test still ran and failed when the database answered slowly.
1 task done
Parallel CI runs of different pull requests used the same Neon, Netlify DB, PlanetScale, SQLite Cloud and Turso databases. One run dropped a table while another created it, and the tests failed with "no such table" and "table already exists". `integration-tests/scripts/ci-databases.ts` now creates databases for one job and drops them at the end: - Neon and Netlify DB get `CREATE DATABASE` with a per-job prefix, which the test setup reads from `CI_DATABASE_PREFIX`. - SQLite Cloud gets `CREATE DATABASE` for each server in `SQLITE_MANY_CLOUD_CONNECTION_STRING`. - PlanetScale gets a branch with its own password. - Turso gets a database and a token from the Platform API for each entry of `TURSODATABASE_REMOTE_URL`. The test step sources the new connection strings from `$RUNNER_TEMP/ci-databases.env`. The drop step runs even when the job fails or is canceled. A daily workflow deletes what a job left behind after one day. PlanetScale and Turso need the new secrets `PLANETSCALE_ORG`, `PLANETSCALE_SERVICE_TOKEN_ID`, `PLANETSCALE_SERVICE_TOKEN`, `TURSO_ORG` and `TURSO_API_TOKEN`. Without them, these providers keep the shared database and the job logs a warning. The test jobs start after `prepare`. They used to start early and poll for the build artifact for at most 10 minutes. With at most 20 jobs at once in the organization, waiting test jobs held runners that `prepare` needed, and the polling used up the repository's API limit. `router.yaml` gets a concurrency group per PR with `cancel-in-progress`, so a new push cancels the run of the previous head before any job starts. The organization runs at most 20 jobs at once, and runs for replaced heads used to hold those slots until the new run's first job got a runner. Every `setup-bun` step pins Bun 1.4.4. Without an exact version the action lists Bun's tags through the GitHub API, which fails with 403 when concurrent runs have used up the repository's API limit.
Decoding of `date`, `timestamp` and `timestamptz` now goes through one parser in `postgres/src/temporal.ts`. The fix covers text and binary scalars, array elements and `Json()` shape leaves on both mappers: - February 29 of 1 BC no longer decodes as March 1. - Values near the end of the `Date` range no longer decode as `Invalid Date` when the session time zone has a positive offset. - Binary timestamps outside 1714-2285 are exact to the millisecond. - JSON leaves with years of 5 or more digits and with a ` BC` suffix decode correctly. Port of drizzle-team/minipg#14.
The npm package is `@drizzle-team/postgres`. The package name, workspace dependencies, import paths, pnpm filters and CI workflows now use it. `@drizzle/postgres` stays only in internal labels: the `Symbol.for` keys, the Effect service keys, the tracer name and the prefix of error messages. This also fixes the workerd test in `cf-starttls.test.ts`. The test expects the `@drizzle-team/postgres/cf` import path in the error message.
…res-name Publish Drizzle Postgres as `@drizzle-team/postgres` again
commit: |
The CommonJS checks ran as concurrent tests, so about 50 node processes ran at once. On a 4-vCPU runner, healthy imports then hit the 5s limit. A pool now runs one process per CPU, and each process is started with `execFile` and an inline script, with no shell and no temporary files. Failures list every import that failed or timed out.
Imports:
- Use default imports for `pluralize` and `glob` instead of named imports.
Both are CommonJS only packages and named imports from them crash when kit runs as ESM under tsx (local development)
- Bundle size: default import only adds 88 bytes (31 for glob and 57 for pluralize)
Pull errors:
- Add `options` to DatabaseDriverCliError and pass `{ cause: e }` from all pull catch blocks, including the --init migrate step
- Text mode: print `e.cause` with console.error after the human message
- JSON mode: add `error.cause` using `inspect` from node:util
JSON.stringify drops an Error's message, stack and cause, whilst inspect gives the same text as console.error
Tests:
- Skip the credential leak test in cli-json.test.ts, as pull now passes the full error
…level`; `pipeline`, `parallel` support for `minipg` drivers, extended config for `batch`
Branch protection can require this one job instead of each pipeline job. The gate waits for every job in the called workflows, so a new job there is covered without a settings change. A skipped job counts as a pass, because the router always skips one pipeline and skips stacked PRs below the top one.
Add a `ci-passed` gate job to the release router
… fixed flaky tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v1.0.0-rc.6
Breaking changes:
Drivers no longer configure output decoding in drivers' configurations - following configurations set by drizzle constructors were removed:
client.options.bigint = truefrombun-sql/postgres,bun-sql/mysqlpostgres-jstypes.setTypeParser(...)fromneon-http,netlify-dbnode-postgres,node-postgres/dsql,vercel-postgres,neon-serverless,netlify-db,cockroach,pglitetypeCastfrommysql2❗
postgres-jsstill overrides client's param serializers (client-wide, replacing user-configured ones) fortimestamptz(1184),timestamp(1114),date(1082),time(1083) and their arrays:Datevalues are sent asvalue.toISOString()- same aspostgres.js' default fortimestamptz,timestamp,datepostgres.js' default re-encodes them vianew Date(value).toISOString(), which reads offset-less timestamps in process' local time, truncates microseconds and throws on values JS can't parse ('infinity','12:00:00')timeswitchesDateprocessing fromdate.toString()to ISO stringDriver config overrides were replaced with cast codecs for types:
pg,cockroach:bigint,bigserial,numeric,date,time,timestamp,interval,json,jsonband their array versionsmysql,singlestore:decimal,date,datetime,timestamp,time,jsonsqlite: integer-based codecs (integer,integer:boolean,integer:timestamp,integer:timestamp_ms) acceptnumber,bigintand integer text, which makes them independent of safe integer modes (better-sqlite3'sdefaultSafeIntegers,bun:sqlite'ssafeIntegers,node:sqlite'sreadBigInts,libsql'sintMode)❗ Results of raw queries (
db.execute(sql...),sqlfields without a column's decoder) now honor driver's configurationpg-proxy,mysql-proxy,singlestore-proxyservers no longer need to replicate drizzle's driver result type configurations (e.g. returningtimestamp,date,intervalas strings viatypes.setTypeParser(...)/typeCast)bigint,safeIntegers,intMode,decimalNumbers,jsonStrings, ...). Custom parsing functions (pg'stypes.setTypeParser(...)/types.getTypeParser,postgres'types,mysql2'stypeCast) that change output of types drizzle doesn't cast still require custom codecs, e.g.:Changed
postgresJsCodecs(drizzle-orm/postgres-js,drizzle-orm/postgres-js/dsql),bunSqlPgCodecs(drizzle-orm/bun-sql/postgres) from plain objects to(client) => codecsfunctions due tojsonparam wrapper functions only being accessible from drivers viaclient.json(param)Fixed
bun-sql/mysqldatetimeinstringreturning trailing zeroes for empty second fractionsBumped minimal supported version of
@types/mssqlpeer dependency from9.1.4to9.1.11to match declarations ofmssql@11.0.1; changedmssql,@types/mssqlpeer dependency version requirements from^to>=Changed shapes of dialect-specific
concat,substringexpressions (drizzle-orm/<dialect>-core/expressions) to match their dialects' functions:mysql,singlestore,mssql:concat(a, b, ...rest)now accepts any number of values (string,number,bigint,Placeholder,SQLWrapper) and emitsconcat(...)instead of||, which is a logicalORinmysql,singlestoreand is unsupported bymssqlbefore SQL Server 2025mysql,singlestore:substring(column, { from, for? })-fromis now required (substring(x for n)is a syntax error);from,foracceptbigintpg,cockroach:substring(column, { from?, for? })now requires at least one offrom,for(substring(x)is an error);fromis cast tointeger(pg) /int8(cockroach) due tosubstring(text from pattern)overload being picked by default;cockroachpositions acceptbigintpg,cockroach: added regular expressionsubstringoverloads:substring(column, { fromPattern })- POSIX regular expression (substring(x from pattern))pg:substring(column, { similar, escape })- SQL regular expression (substring(x similar pattern escape escape))cockroach:substring(column, { fromPattern, escape })- POSIX regular expression withescapein place of\(substring(input, regex, escape_char))sqlite:substring(column, { from?, for? })->substring(column, start, length?), emitssubstr(x, start[, length])instead of unsupportedsubstring(x from ... for ...);start,lengthacceptbigintmssql:substring(column, { from?, for? })->substring(column, start, length), emitssubstring(x, start, length)instead of unsupportedsubstring(x from ... for ...)concatvalues andsubstringarguments are no longer encoded with the column's encoder - they are not expected to share the column's typeFixed subqueries selected as fields being inferred as non-nullable - a subquery can return no rows, so their values are now typed as
| null. This also applies to such fields re-selected from views and subqueries built from these selections:Fixed
effect-postgresfailing to encode empty array params (Cannot infer the type of an empty array) oftext,varchar,char,bool,smallint,int,bigint, serial types,float4,float8,byteacolumns (fixes #6566)Fixed
effect-postgresbigint,bigserialcolumns inbigintmode returning strings whenPgClientdecodesint8as text (fixes #6566)Fixed
bun-sqlpostgresbigint,bigserialcolumns inbigintmode returning strings sincebunstarted ignoringoptions.bigintset after client's constructionFixed
bun-sqlpostgresempty multidimensionalintegerarrays being returned asInt32ArrayFixed
is()narrowing columns tonever:pg:text,varchar,charwithenum(is(column, PgText)), plainvarchar,charcockroach:cockroachEnumcolumns (is(column, CockroachEnumColumn))mysql:blob,tinyblob,mediumblob,longblobinbuffermode (is(column, MySqlBufferBlob))Fixed
mysql,singlestoreenum columns narrowed byis()havingcolumn.enumValuestyped as| undefinedFixed
cockroachcockroachEnumcolumns being typed withstringdataTypeinstead ofstring enum, which made validators inferstringinstead of the enum's valuesFixed
mysqlblob,tinyblob,mediumblob,longblobinbuffermode havingstringdataTypeinstead ofobject buffer, which made validators generate string schemas forBuffervaluesFixed validators inferring
stringinstead of enum members for columns of enums made from TS enums (pgEnum,cockroachEnum,mysqlEnum)Fixed
drizzle-orm/zodcreateSchemaFactorywithoutcoerceoption breaking refine callbacks' parameter type inference (Parameter 'schema' implicitly has an 'any' type) (fixes #5968)Fixed
postgres-jserrors onjson,jsonbcolumns' params withboolean,Date,Buffer,Uint8Arrayvalues and arrays starting with them (column "..." is of type jsonb but expression is of type ...) (fixes [BUG]: postgres-js: top-level boolean/Date/bigint values fail to insert into jsonb columns in 1.0.0-rc.5 #6582)Fixed
bun-sql/postgreserrors onjson,jsonbcolumns' params with top-levelnumber,boolean,Buffer,Uint8Arrayvalues (fixes [BUG]: bun-sql: top-level number/boolean values fail to insert into jsonb columns in 1.0.0-rc.5 #6591)Fixed
bun-sql/postgreswithprepare: falseerrors onjson,jsonbcolumns' params (fixes #6132)Fixed
node-postgres,neon-serverless,vercel-postgres,netlify-dberrors onjson,jsonbcolumns' params withDate,Buffer,Uint8Arrayvalues (invalid input syntax for type json)Fixed type errors in emitted declarations with
skipLibCheck: false(fixes #5187):Cannot find module 'mysql2'in projects withoutmysql2installed - general modules (drizzle-orm,drizzle-orm/pg-core, ...) no longer reference driver packages' typesClass 'PgRole' incorrectly implements interface 'PgRoleConfig'(same forPgPolicy,CockroachRole,CockroachPolicy) withexactOptionalPropertyTypesType 'Buffer' is not genericon TypeScript 5.6 and older inmysql-coreblobcodecs anddrizzle-orm/arktype'sbufferSchemaFixed: [BUG]: PostgreSQL: after
drizzle-kit pull,generateandpushemitSET DEFAULTfor anumericcolumn with an expression default #6495Thanks to @pintu544 for opening this pull request - [Pg-kit]: Do not quote expression defaults of numeric columns on introspect #6516
Fixed: [BUG]: drizzle-kit pull writes
as: "function toLowerCase() { [native code] }"for a RESTRICTIVE policy on CockroachDB #6492Thanks to @shaurya703 for opening this pull request - [Kit]: Fixed
drizzle-kit pullwriting a function for a RESTRICTIVE CockroachDB policy #6518Fixed: [BUG]: SQLite
generateignores an index changing betweenuniqueIndexandindex#6557Thanks to @tlq5l for opening this pull request - Drop and recreate SQLite indexes that change between index and uniqueIndex #6561
Fixed: [BUG]: Dropping a column writes a failing migration when a check or unique constraint naming it changes in the same diff #6472
Thanks to @Adnan-Husayn for opening this pull request with the proposed solution - [Pg-kit]: Drop an altered check or unique constraint before its column #6483
Fixed: [BUG]: drizzle-kit pull (MySQL) fails with "Check constraint conflict" when another database on the same server has a CHECK constraint with the same name #6447
Thanks to @Saadanjum0, @drago1520 and @shreyanshj10 for opening those pull requests - [MySQL-kit] Fix check constraint introspection matching across databases #6450, [drizzle-kit] fix: MySQL pull fails with "Check constraint conflict" when another database has a CHECK with the same name #6449, [Mysql-kit]: Scope the check constraints join to the pulled schema #6448
Fixed: [BUG]: SQL Server diizzle-kit pull error when IDENTITY seed = 0 #6423
Thanks to @yousefissa for opening this pull request - https://github.com/drizzle-team/drizzle-orm/pull/6432
Fixed: [BUG]: drizzle-kit push fails to introspect MSSQL schemas owned by Microsoft Entra users #6357
Thanks to @zhamann for opening this pull request - fix(drizzle-kit): introspect Entra-owned MSSQL schemas #6358
Fixed: [BUG]: drizzle-kit for postgres generates incorrect migration when changing IDENTITY column to uuid #4178
Thanks to @yyuneu for opening this pull request - [Pg-kit]: Drop identity before changing a column's type #6226
Fixed: fix(pg): fix sparsevec_l2_ops typo and test composite index opclasses #6188. Thanks to @webdevsamran for opening this pull request
Fixed: [BUG]: drizzle-kit pull writes an expression default as plain code or as a string for several column types (PostgreSQL, CockroachDB, SQLite, MySQL) #6493
Thanks to @pintu544 and @shaurya703 for opening these pull requests - [Pg-kit]: Emit expression defaults as sql templates in toTs instead of broken literals #6521, Fixed
drizzle-kit pullwriting expression defaults as code or strings #6519Fixed query buidlers dropping offset with
0value (fixes [BUG]: .offset(0) writes no offset, so a subquery fenced with offset 0 is merged into its outer query #6599)Fixed [BUG]: node-postgres transaction() still returns the client to the pool when BEGIN times out #6622
Fixed [BUG]: durable-sqlite .get() leaves the statement open when several rows match, so a later DROP INDEX fails with SQLITE_LOCKED #6550
Fixed
effect-sqlite-do,effect-sqlite-bun,effect-sqlite-wasm.run()result type:[]->readonly Record<string, unknown>[]Fixed [BUG]: SQLite onConflictDoNothing places the target WHERE after DO NOTHING (partial unique indexes) #6531
mysql,singlestore:$returningIdcan no longer be combined withonDuplicateKeyUpdateas the result can't report updated rows' idsFixed [BUG]: pg timestamp: a Date past the year 9999 is sent as "+010000-…", which PostgreSQL refuses (22009) #6552:
+010000-01-01T00:00:00.000Z) are sent without the expanded-year sign:10000-01-01T00:00:00.000Z0000-01-01T00:00:00.000Z,-000001-...) are sent with theBCsuffix:0001-01-01T00:00:00.000Z BCFixed
pg,cockroachtimestamp,datecolumns indatemode decoding values thatnew Date(text)misreads:0099-12-31 23:59:59+00-> 1999)datevalues past year 9999 were read in process' local timeBCsuffix and with seconds-precision UTC offsets were decoded asInvalid DateFixed
pgtimestamp,datecolumns indatemode being decoded as wrong dates orInvalid Datein sessions with non-ISODateStyle(fixes [BUG]: node-postgres: timestamptz read as Invalid Date or a wrong date when Postgres prints a seconds offset (LMT) or a non-ISO DateStyle #6496)Fixed
aws-data-api/pgtimecolumns losing fractional seconds past milliseconds andtimestampcolumns (date,stringmodes) losing theBCsuffix of values with fractional seconds: they are now selected as text instead of Data API's own formattingFixed
postgres/aurorafailing queries (HTTP 500on the AWS Data API emulator) selectingtimestamptzvalues with years past 9999 or seconds-precision UTC offsets, and thetime,timestampformatting losses above:time,timestamp,timestamptzcolumns are now selected as textFixed [BUG]: not() returns
SQL | undefinedeven for a defined condition since 1.0.0-rc.5 #6625Fixed [BUG]: MySQL generate stops when a new foreign key points to a table that is not exported from the schema #6534
Fixed [BUG]: drizzle-kit pull crashes on MSSQL when tablesFilter excludes referenced FK table #5992
Fixed [BUG]: SQLite pull reports every error after the connection as "Failed to connect to or introspect the SQLite database", dropping the cause #6501
Fixed [BUG]: drizzle-kit ignores tsconfig
pathsmapping"*"under Node (only trailing/*keys supported) #6593Fixed [BUG]: drizzle-kit's tsconfig path-alias resolver does not follow "extends" #5712
Fixed
pgtransaction config allowingsnapshotwithoutisolationLevel: 'repeatable read' | 'serializable'Fixed
arrayCompatNormalize(drizzle-orm/pg-core) passingnullarray elements to normalizer instead of skipping them