npm / typeorm
typeorm
What changed in typeorm 0.3 to 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
158 breaking9 security31 new APIs and options4 performance12 behavior and defaults6 tooling96 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli inittypeorm 1288 changes
Breaking changes 156
The inverse foreign key defaults to CASCADE.
Invalid where values now default to throwing on the write path.
Rejects empty where criteria for update and delete operations.
AbstractRepository is removed; use Repository.extend() instead.
The MongoDB appname option was removed; use appName instead.
BaseConnectionOptions was renamed to BaseDataSourceOptions.
better-sqlite3 is now the default SQLite driver.
The internal Broadcaster method is removed.
The deprecated broadcastLoadEventsForAll method has been removed.
The Buffer polyfill is removed; Uint8Array is used for binary data on non-Node platforms, while Node.js Buffer continues to work.
The SQLite busyTimeout option was replaced by timeout for better-sqlite3.
unsigned is removed for decimal/float ColumnNumericOptions; integer unsigned is unchanged.
The deprecated unsigned option has been removed from ColumnNumericOptions.
Connection is removed; use DataSource instead.
Use dataSource.destroy() instead of connection.close().
Use dataSource.initialize() instead of connection.connect().
Use dataSource.isInitialized instead of connection.isConnected.
The property on drivers, query runners, managers, builders, metadata, and subscriber interfaces is renamed to dataSource; a deprecated getter bridges the change.
The property was renamed to dataSource in Driver, QueryRunner, EntityManager, QueryBuilder, EntityMetadata, and event classes; a deprecated getter was added for EntityManager.
ConnectionManager and global convenience functions, including createConnection, getConnection, getManager, getRepository, and createQueryBuilder, are removed.
ConnectionManager was removed; create and manage DataSource instances directly.
The codemod flags constructions of the removed ConnectionManager class.
ConnectionOptions is removed; use DataSourceOptions instead.
The deprecated environment-variable reader class was removed, along with TypeORM_* connection configuration and ormconfig.env support.
Configuration paths are resolved from process.cwd() rather than app-root-path; pass { root: "/custom/path" } to the constructor to override.
The method is renamed to get().
The codemod renames ConnectionOptionsReader.all() to get() and flags the path semantics change.
get() now returns all configurations as an array; the old get(name) form was removed.
The old has(name) method was removed.
The deprecated IoC container integration type was removed; TypeORM no longer has built-in IoC container support.
The deprecated global function was removed; use the equivalent DataSource instance method.
The deprecated global function was removed; manage DataSource instances directly.
The deprecated global function was removed; use dataSource.createQueryBuilder().
Replaces the connection property on drivers, query runners, managers, builders, metadata, and subscriber interfaces.
The property is removed because named connections were deprecated in v0.3.
The conditions parameter now uses entity-aware types instead of any.
The MS SQL Server connection option has been removed; use authentication with NTLM type instead.
The method is removed; use buildAlias() instead.
Preserves null property values when merging into an entity.
The static method is removed as an internal utility with no public replacement.
The options parameter is removed because skipNulls was never functional; remove the third argument.
The decorator is removed; use Repository.extend() instead.
TypeORM no longer auto-loads .env files or depends on dotenv.
The minimum supported Expo SDK version is 52.
The log path is resolved from process.cwd(); use an absolute path when the app is not started from its root folder.
The deprecated findByIds method has been removed from EntityManager, Repository, and BaseEntity; use findBy with the In operator instead.
The deprecated findByIds method has been removed from Repository and EntityManager.
The deprecated findOneById method has been removed from EntityManager, Repository, BaseEntity, MongoEntityManager, and MongoRepository; use findOneBy instead.
The codemod flags use of the removed join property in FindOneOptions and FindManyOptions.
The SQLite driver option has been removed.
The SQLite flags option was removed because better-sqlite3 does not support the C-level open flags; use dedicated options such as readonly or enableWAL.
The MongoDB fsync connection option was removed; use writeConcern with journal: true.
The deprecated global function was removed; use DataSource instance methods.
The deprecated global function was removed.
The deprecated global function was removed.
The function is removed; use Repository.extend() instead.
The IoC container system, including getFromContainer(), is removed.
The deprecated global function was removed; use the corresponding DataSource instance method.
The global function is removed; use dataSource.mongoManager instead.
The global function is removed; use dataSource.getMongoRepository() instead.
Checking for pending migrations no longer creates the migrations table.
The deprecated global function was removed; use dataSource.getRepository().
The deprecated global function was removed.
The deprecated global function was removed; use the equivalent DataSource instance method.
The deprecated SAP HANA connection alias was removed; use driver.
The conditions parameter now uses entity-aware types instead of any.
The setting applies only to high-level APIs; QueryBuilder where(), andWhere(), and orWhere() are no longer affected.
The default is throw; null or undefined in where conditions now raises an error instead of silently ignoring the property. Use IsNull() for null matching.
The deprecated IoC container system has been removed.
The MongoDB j connection option was removed; use writeConcern with journal: true.
The deprecated join property on FindOneOptions and FindManyOptions has been removed, along with JoinOptions; use relations for leftJoinAndSelect or QueryBuilder for other join types.
Explicit shared join-column entries between relations are no longer dropped during persistence.
The MongoDB keepAlive option was removed because it is always enabled since MongoDB Driver v6.0.
The MongoDB keepAliveInitialDelay option was removed because it is not configurable since MongoDB Driver v6.0.
The MySQL option now defaults to false, using standard ST_GeomFromText/ST_AsText functions by default.
Update and SoftDelete query builders throw at call time for non-numeric values instead of interpolating them into SQL.
SelectQueryBuilder.loadRelationCountAndMap() has been removed; use @VirtualColumn or a sub-query in a query builder instead.
The method is removed; use getPendingMigrations(), getExecutedMigrations(), or dataSource.migrations instead.
Deprecated MongoDB connection options have been removed.
MongoDB driver v7+ is required; support for versions 5 and 6 has been dropped.
DataSource isolation options were renamed and proper values are assigned during createPool.
The mysql package is no longer supported for MySQL/MariaDB; only mysql2 is supported, and the connectorPackage option is removed.
MysqlConnectionOptions was renamed to MysqlDataSourceOptions; the same pattern applies to all drivers.
Internal nativeParameters plumbing is removed from drivers and query builders.
Versions 10 and 11.0.0 attempt to register the removed Connection class and crash at startup; upgrade to v11.0.1 or later for TypeORM v1 compatibility.
Node.js 20+ is required; support for Node.js 16 and 18 has been dropped, and the minimum JavaScript target is ES2023.
ManyToOne and owning OneToOne relations marked nullable: false now use INNER JOIN instead of LEFT JOIN, which may exclude rows with orphaned foreign keys.
MongoDB internal types are no longer re-exported from typeorm; import them directly from mongodb.
Replacing children deletes orphaned rows with non-nullable foreign keys; nullable foreign-key rows are still nullified.
Isolation-level values now use spaces instead of underscores to match the format used throughout TypeORM.
The option is renamed to options.isolationLevel; values use the IsolationLevel format, and SNAPSHOT is added.
Replaces options.isolation for MS SQL Server; values use the IsolationLevel format, and SNAPSHOT is supported.
The ormconfig.env file format is no longer supported; use a TypeScript or JavaScript configuration file.
The deprecated lock mode is replaced by pessimistic_write with the onLocked option.
This deprecated lock mode was removed; use
pessimistic_writewithskip_lockedinstead.The deprecated pessimistic_partial_write lock mode has been removed.
This deprecated lock mode was removed; use
pessimistic_writewithnowaitinstead.The deprecated pessimistic_write_or_fail lock mode has been removed.
The SAP HANA pool.checkInterval option was removed with no replacement.
The deprecated SAP HANA pool.idleTimeout option was removed; use pool.maxPooledIdleTime in seconds.
The deprecated SAP HANA pool.max option was removed; use pool.maxConnectedOrPooled.
The SAP HANA option now defaults to 30 seconds and no longer falls back to pool.idleTimeout.
The SAP HANA pool.maxWaitingRequests option was removed with no replacement.
The SAP HANA option now defaults to 0 and no longer falls back to pool.requestTimeout.
The SAP HANA pool.min option was removed with no replacement.
The deprecated SAP HANA pool.requestTimeout option was removed; use pool.maxWaitTimeoutIfPoolExhausted.
SHA1 is now applied directly to hash input instead of applying encodeURIComponent first; existing query result cache entries are invalidated and rebuilt.
logQuery was removed after printSql was renamed to it.
onConflict() is removed; use orIgnore() or the orUpdate() array signature.
The deprecated overload is removed; use the array signature.
The method is removed; executed queries are already logged through the configured logger. Use getSql() or getQueryAndParameters() to inspect SQL.
printSql was renamed to logQuery, and logQuery was subsequently removed.
The method is removed because it was a no-op.
The method is removed; use setParameters() instead.
The update(partialEntity) signature now uses an entity-aware type instead of a loose object.
useIndex no longer accepts raw SQL; pass an index name or an array of index names.
The property was removed; use
QueryExpressionMap.parametersinstead.The property is removed; use getTables() instead.
The property is removed; use getViews() instead.
The empty no-op method, which was never called, is removed.
The column option is removed; use update: false instead.
Support for legacy v3 Redis clients was removed; upgrade redis or ioredis clients to v4 or later.
The decorator is removed; use @VirtualColumn with a sub-query instead.
String-array relations syntax is removed; use object syntax such as relations: { profile: true }.
The method is removed; use Repository.exists() instead.
Deprecated SapConnectionOptions properties have been removed.
String-array select syntax is removed; use object syntax such as select: { id: true }.
Columns marked select: false are excluded from find and query-builder reads; use addSelect to opt in. Values on saved in-memory entities remain untouched.
The deprecated SQL Server domain connection option has been removed.
The sqlite3 package is no longer supported; better-sqlite3 is the default SQLite driver.
The MongoDB ssl connection option was removed; use tls instead.
The MongoDB sslCA connection option was removed; use tlsCAFile instead.
The MongoDB sslCert connection option was removed; use tlsCertificateKeyFile instead.
The MongoDB sslCRL connection option was removed with no replacement.
The MongoDB sslKey connection option was removed; use tlsCertificateKeyFile instead.
The MongoDB sslPass connection option was removed; use tlsCertificateKeyFilePassword instead.
The MongoDB sslValidate connection option was removed; use the inverted tlsAllowInvalidCertificates option instead.
The MongoDB stats() method has been removed.
stats() was removed from MongoQueryRunner, MongoEntityManager, and MongoRepository; use the $collStats aggregation stage, whose response shape differs.
Support for TYPEORM_* environment variables is removed, along with ConnectionOptionsEnvReader, ormconfig.env, and dotenv auto-loading.
Connection configuration via TYPEORM_CONNECTION was removed; use a TypeScript or JavaScript configuration file.
The init command no longer crashes without package.json, includes scaffolding devDependencies in the published package, and no longer runs npm install.
LegacyOracleNamingStrategy and NamingStrategyV03 are no longer exported from TypeORM core; install this package and import them from it if needed.
This package is no longer compatible with TypeORM after built-in IoC container support was removed.
Its
InjectManagerandInjectRepositorydecorators are no longer the supported way to inject managers or repositories; access them from a DataSource instead.Connection configuration via TYPEORM_URL was removed; use a TypeScript or JavaScript configuration file.
The IoC container system, including useContainer() and getFromContainer(), is removed.
The deprecated IoC container integration function was removed; TypeORM no longer has built-in IoC container support.
The MongoDB useNewUrlParser option was removed; it has been a no-op since MongoDB Driver v4.0.
The MongoDB useUnifiedTopology option was removed; it has been a no-op since MongoDB Driver v4.0.
The MongoDB w connection option was removed; use writeConcern with w: 1.
The
WhereExpressiontype alias was removed; importWhereExpressionBuilderinstead.The MySQL column option has been removed.
The MySQL width column option is no longer supported; remove it from column definitions.
The MongoDB wtimeout connection option was removed; configure wtimeoutMS under writeConcern instead.
The MongoDB wtimeoutMS connection option was removed; configure it under writeConcern instead.
Security 6
TypeORM: migration:generate template-literal code injection
Validates condition values at runtime to prevent injection through order expressions.
The method accepts one or more index names and escapes them as identifiers instead of interpolating raw SQL, preventing identifier injection.
Queries are parameterized and identifiers escaped to prevent SQL injection.
Queries across all drivers are parameterized; PostgreSQL and CockroachDB clearDatabase queries are parameterized as well.
All drivers use parameterized queries and escaped identifiers to prevent SQL injection through database, schema, table, or column names.
New APIs and options 21
DateUtils is exported from the package entry point.
RelationMetadata is exported for package consumers.
Adds support for distinct count.
Aurora PostgreSQL now supports transaction isolation levels.
The clear() method now supports cascade truncate.
SAP HANA now supports generated columns using generatedType: "STORED" and asExpression.
Adds deferrable support, matching the existing support on @Unique and @Index.
Adds an ifExists flag to drop methods for columns, indexes, keys, and constraints, including plural variants.
Adds INSERT INTO ... SELECT FROM ... support for data migration and transformation queries.
Adds a PostgreSQL option to install additional extensions during connection setup.
SQLite now supports the jsonb column type.
Adds a SAP HANA pool option for the maximum wait timeout when the pool is exhausted.
MongoDB find*() methods accept object-based select syntax, in addition to the existing string-array form.
MySQL query types now include named parameters.
PostgreSQL indices are now supported.
Adds support for PostgreSQL partial indexes.
Supports explicit resource management with await using syntax (TypeScript 5.2+) for automatic cleanup.
Adds an option to pass an encryption key for React Native SQLite databases.
Accepts { cascade: true } to issue TRUNCATE ... CASCADE on PostgreSQL, CockroachDB, and Oracle.
Repository and entity manager update() and upsert() methods support a returning option on databases that support RETURNING clauses.
FOR UPDATE and other lock modes are supported in SAP HANA queries.
Performance 4
Query execution timing uses performance.now().
sqljs measures query execution time after the statement runs.
Avoids quadratic grouping when raw results are selected without primary keys.
PostgreSQL and CockroachDB consolidate individual DROP statements into batched queries, reducing round-trips during test setup.
Behavior and default changes 11
The Expo driver loads expo-sqlite through loadDependencies(), so callers no longer need to pass the module explicitly.
Leading and trailing whitespace is no longer included in logged query strings.
TypeORM instantiates migrations internally with a zero-argument constructor, so dependencies cannot be passed as pre-built instances; access services through the DataSource.
Driver errors retain the originating call site to make query failures easier to debug.
Non-nullable ManyToOne and OneToOne relations use inner joins.
Loading failures now log warnings instead of failing silently.
When possible, adding enum values uses ALTER TYPE ... ADD VALUE instead of the four-step rename-create-migrate-drop approach.
Eager relations use separate queries when the strategy is set to query, rather than always using JOINs.
Skips rows that are already soft-deleted.
Google Spanner now honors isolationLevel; supported levels are REPEATABLE READ (currently in preview) and SERIALIZABLE.
The schema builder no longer attempts to create columns for virtual properties.
Tooling 6
The codemod can detect incompatible ecosystem packages and bump their dependency versions.
The codemod flags FileLogger usage when logPath is not absolute.
Entity and migration file discovery now uses tinyglobby instead of glob, described as a drop-in replacement for most projects.
The codemod flags use of loadRelationCountAndMap and provides relation-count guidance.
Runs the v1 migration codemod on the supplied source directory.
Automates many v1 breaking-change updates, including imports, API renames, and find option syntax.
Fixes and other changes 84
Database cache runners are released after failed removals.
Lazy relations are not loaded when building the entity id map.
Null values are guarded when using the orderBy object shorthand.
Static require calls are used for bundler compatibility.
SQL Server query locks are released after subscriber errors.
MSSQL table lock hints are placed inside nested join parentheses.
The utc flag is honored when detecting changed date columns.
Reads closure-table primary values through column metadata.
Releases all query runners before closing the pool.
Prevents composite primary key collisions during hydration.
Prevents connection leaks during initialization.
Handles schema and table names correctly in generated columns in the metadata table.
Compares spatial columns against their default feature type and SRID for Postgres and CockroachDB.
Keeps the STI discriminator index on entities with embeddeds.
Child joins are nested only when outer join semantics require it.
Postgres reads coord_dimension when loading spatial columns.
Returns undefined when the requested path is missing.
Function defaults are evaluated before enum or string normalization.
Metadata access is guarded for raw-table upserts.
Relation values for join columns inside embedded entities are resolved correctly.
Junction rows are kept when the relation is not loaded.
better-sqlite3 awaits query event subscribers and reports failed queries.
Query runners created by clear and getFromCache are released.
Versions of unequal length are compared correctly.
Fixes normalization of FindOptionsWhere criteria containing arrays and Buffers.
Validates where criteria in increment and decrement operations.
Correctly wraps inner joins nested under left joins.
Fixes multiple problems with recursive common table expressions.
Columns marked select false are preserved on the in-memory entity after save().
Releases the query runner when an error occurs while storing a query result in the cache.
Improves normalizeDatetimeFunction handling for the PostgreSQL tstzrange data type.
Resolves database column names, such as created_at, rather than only property names.
Aurora Postgres now honors isolationLevel on the DataSource and on explicit startTransaction() calls.
Cascade remove on OneToMany now propagates to child entities with composite primary keys.
Cascade removal now deletes one-to-many child entities before the parent; cascade traversal is scoped to the matching operation type.
Propagates schema and database settings to closure junction tables.
Referenced columns are sorted to match the referenced primary-key index order, preventing constraint rejection on MySQL, MSSQL, and SAP HANA.
Query results now include the count of affected rows.
Removes incorrect error handling that blocked certain to-many relation configurations.
The DataSource-level default isolation level is honored by every driver that supports transactions; DataSource-started transactions use it by default.
Fixes false-positive dirty detection with date value transformers.
Corrects the process dependency import for Deno.
Explicitly specifying an eager relation in relations no longer creates duplicate JOINs.
MongoDB correctly processes embedded arrays within nested document structures.
The Entity comment option now works with SAP HANA.
Conditions for increment and decrement operations have improved typing.
MongoDB queries translate an ObjectIdColumn property such as id to _id.
Value transformers now correctly transform values inside FindOperator instances such as In and Between.
Join parsing now works when conditions contain brackets.
Fixes incorrect behavior when using join map methods with subqueries.
Accepts array values and generates the expected PostgreSQL @> containment predicate.
Pagination subqueries include joined entity primary keys so related entities load correctly.
Honors the deferrable option on junction table foreign keys.
Fixes change detection for Map and plain object column values.
Schema introspection scopes computed columns to the correct table when tables share column names.
Ordering by subquery columns no longer causes a Cannot get metadata for given alias error.
Column aliases are properly escaped, preventing SQL errors when alias names conflict with reserved words.
Orphaned-row nullification now handles non-nullable foreign keys.
MySQL getVersion() no longer returns undefined for PolarDB-X 2.0.
Enum values load in declared order, preventing generated migrations from changing when nothing has changed.
Point and circle values are normalized on persist to avoid invalid input errors when re-saving hydrated objects.
Queries are executed sequentially to avoid the pg 8.19.0 deprecation warning.
Queries execute sequentially on the same connection to avoid pg 8.19.0 deprecation warnings, including relation-load and persistence paths.
The attempted semicolon rejection in raw SQL expression methods was reverted, preserving the intended QueryBuilder behavior.
Corrects SQL generation when using QueryBuilder .update().
The update query builder now has proper entity typing.
Fixes handling of table names containing special characters on PostgreSQL and CockroachDB.
Fixes a TypeError when mapping relation IDs within embedded entities.
Uses DriverUtils.getAlias to prevent alias trimming by databases with short identifier limits.
Aggregate functions such as repo.max() and repo.min() no longer generate an invalid ORDER BY clause.
JavaScript Date values are passed as query parameters instead of being embedded in SQL strings.
Fixes save failures when an entity has eagerly loaded relations.
getQuery() and getSql() preserve the order in which columns were added with select() and addSelect().
With relationLoadStrategy set to query, self-referencing relations no longer generate incorrect SQL from alias collisions.
Correctly handles camelCase_aliases.
SQLite simple-enum columns with array: true no longer fail with CHECK constraint errors.
Fixes incorrect results from pagination with joins.
Dropping a foreign key without an explicit name no longer fails.
PostgreSQL columns of this type now persist and hydrate correctly.
Updates mpath correctly when re-parenting, including when parents are soft-deleted.
Corrects column references in upsert queries involving table inheritance and custom schemas.
Correctly handles columns that should not be updated, including update: false or generatedType columns.
Preserves the flag during CockroachDB transaction retry replay.
Recovering soft-removed entities with many-to-many relations no longer attempts to reinsert existing junction rows.
typeorm 0.328 changes
Breaking changes 2
Reverts the fix for limit behavior with joins.
Makes the method using setFindOptions() async.
Security 3
Validates limit() in Update and SoftDelete query builders.
TypeORM: SQL Injection in UpdateQueryBuilder/SoftDeleteQueryBuilder orderBy (MySQL/MariaDB)
Upgraded glob to address CVE-2025-64756.
New APIs and options 10
Adds a pool timeout option for SAP.
Entity schemas now support trees.
PostgreSQL columns now support the jsonpath column type.
The MongoDB connector now includes SOCKS5 proxy settings.
MySQL now supports pool size options for each connection.
Exported QueryDeepPartialEntity for use by developers.
Exported QueryPartialEntity for use by developers.
Added a utc flag to date columns.
MS SQL Server now supports the vector type.
MariaDB and MySQL now support vector columns.
Behavior and default changes 1
The PostgreSQL driver initializes the version only if it has not already been set.
Fixes and other changes 12
Calls to require() that break bundlers are removed.
Scopes invalidWhereValuesBehavior to high-level abstractions only.
Adjusts the CockroachDB join in loadTables to load the correct table columns.
Preserves user-defined shared join columns in the change set.
Fixes ambiguous-column errors in aggregate methods.
Fixes escaping of JavaScript Date parameters in SAP QueryBuilder.
Prevents eager-loaded entities from overwriting manual relations.
Releases the query runner when there is no migration to revert.
Fixes Redis cache version detection.
Added the missing findBy method to MongoEntityManager.
Added multiSubnetFailover to the MSSQL driver option types so the option can be typed when configuring the driver.
Fixed the Redis version detection logic.