TypeORM 1.0 Release Notes
TypeORM 1.0 is a major release that removes long-deprecated APIs, modernizes platform requirements, and ships dozens of bug fixes and new features accumulated during the 0.3.x cycle.
Breaking changes
See the Migration Guide for detailed upgrade instructions.
Platform requirements
- Node.js 20+ required — support for Node.js 16 and 18 has been dropped, and the minimum JavaScript target is now ES2023 (#11382 by @alumni)
Bufferpolyfill removed —Uint8Arrayis now used for binary data on non-Node platforms; Node.jsBuffer(which extendsUint8Array) continues to work as before (#11935 by @pujux)- Glob library replaced —
globhas been replaced withtinyglobbyandrimrafhas been removed, resulting in fewer dependencies (#11699 by @alumni) - Hashing moved to native
crypto— thesha.jsanduuidpackages have been replaced with the nativecryptomodule andcrypto.randomUUID()(#11864 by @G0maa, #11769 by @mag123c)
Driver changes
- MySQL / MariaDB:
mysqlpackage dropped — onlymysql2is supported; theconnectorPackageoption has been removed (#11766 by @pkuczynski) - MySQL:
legacySpatialSupportnow defaults tofalse— standardST_GeomFromText/ST_AsTextfunctions are used by default (#12083 by @pkuczynski) - MySQL:
widthandzerofillcolumn options removed — these were deprecated in MySQL 8.0.17 and removed in MySQL 8.4 (#12084 by @pkuczynski) - SQLite:
sqlite3dropped,better-sqlite3is the default — thesqlite3package is no longer supported;flagsandbusyTimeoutoptions have been removed (#11836 by @pkuczynski) - MongoDB: driver v7+ required — support for MongoDB Node.js driver v5/v6 has been dropped;
stats()method removed; deprecated connection options removed; internal types are no longer exported (#12208 by @naorpeled, #12179 by @pkuczynski, #12120 by @pkuczynski, #12037 by @alumni) - MS SQL Server:
domainconnection option removed — useauthenticationwith NTLM type instead (#12135 by @pkuczynski) - SAP HANA: deprecated connection aliases removed —
hanaClientDriver,pool.max,pool.requestTimeout,pool.idleTimeout, and others have been removed in favor of their modern equivalents (#12080 by @gioboa) - Expo: legacy driver removed — the legacy Expo SQLite driver has been removed; use Expo SDK v52+ with the modern async API (#11860 by @G0maa)
- Redis: legacy client support removed — only modern Redis client (v4+) is supported for query result caching (#12057 by @G0maa)
Removed APIs
ConnectionandConnectionOptionsremoved — useDataSourceandDataSourceOptionsinstead (#12022 by @alumni)ConnectionManagerand global convenience functions removed —createConnection,getConnection,getManager,getRepository,createQueryBuilder, and other globals have been removed (#12098 by @michaelbromley)getMongoRepositoryandgetMongoManagerglobals removed — usedataSource.getMongoRepository()anddataSource.mongoManagerinstead (#12099 by @pkuczynski)DataSource.nameremoved — named connections were deprecated in v0.3;ConnectionOptionsReader.all()renamed toget()(#12136 by @pkuczynski)TYPEORM_*environment variable support removed —ConnectionOptionsEnvReader,ormconfig.env, anddotenvauto-loading have been removed (#12134 by @pkuczynski)findByIdsremoved — usefindBywithInoperator instead (#12114 by @pkuczynski)Repository.exist()removed — useRepository.exists()instead (#12131 by @pkuczynski)AbstractRepository,@EntityRepository, andgetCustomRepositoryremoved — useRepository.extend()instead (#12096 by @pkuczynski)@RelationCountdecorator removed — use@VirtualColumnwith a sub-query instead (#12181 by @pkuczynski)- IoC container system removed —
useContainer(),getFromContainer(), and related types have been removed (#12180 by @pkuczynski) readonlycolumn option removed — useupdate: falseinstead (#12132 by @pkuczynski)unsignedonColumnNumericOptionsremoved — only affected decimal/float types; integerunsignedis unchanged (#12133 by @pkuczynski)- QueryBuilder:
onConflict(), deprecatedorUpdate()overload, andsetNativeParameters()removed — useorIgnore()/orUpdate()array signature andsetParameters()instead (#12090 by @pkuczynski) - QueryBuilder:
printSql()renamed tologQuery()(#12151 by @naorpeled) - QueryBuilder:
WhereExpressiontype alias removed — useWhereExpressionBuilderinstead (#12097 by @pkuczynski) - QueryBuilder:
replacePropertyNames()removed — it was a no-op (#12178 by @pkuczynski) - Deprecated lock modes removed —
pessimistic_partial_writeandpessimistic_write_or_failreplaced bypessimistic_writewithonLockedoption (#12093 by @pkuczynski) QueryRunner.loadedTablesandloadedViewsremoved — usegetTables()andgetViews()instead (#12183 by @pkuczynski)MigrationExecutor.getAllMigrations()removed — usegetPendingMigrations(),getExecutedMigrations(), ordataSource.migrationsinstead (#12142 by @pkuczynski)EntityMetadata.createPropertyPath()static method removed — internal utility with no public replacement (#12141 by @pkuczynski)- Internal
nativeParametersplumbing removed from drivers and query builders (#12104 by @pkuczynski) - Internal
broadcastLoadEventsForAll()removed from Broadcaster (#12137 by @pkuczynski) - Internal
DriverUtils.buildColumnAlias()removed — usebuildAlias()instead (#12138 by @pkuczynski)
Behavioral changes
invalidWhereValuesBehaviordefaults tothrow— passingnullorundefinedin where conditions now throws an error instead of silently ignoring the property; useIsNull()for null matching (#11710 by @naorpeled)invalidWhereValuesBehaviorscoped to high-level APIs only — QueryBuilder's.where(),.andWhere(),.orWhere()are no longer affected by this setting (#11878 by @naorpeled)
New features
Query Builder
INSERT INTO ... SELECT FROM ...— newvaluesFromSelect()method onInsertQueryBuilderfor data migration and transformation queries (#11896 by @Cprakhar)returningoption for update/upsert — repository and entity managerupdate()andupsert()methods now support areturningoption on databases that supportRETURNINGclauses (#11782 by @naorpeled)ifExistsparameter on all drop methods —dropColumn,dropIndex,dropPrimaryKey,dropForeignKey,dropUniqueConstraint,dropCheckConstraint,dropExclusionConstraint, and their plural variants now accept anifExistsflag (#12121 by @pkuczynski)- Explicit resource management for
QueryRunner— supportsawait usingsyntax (TypeScript 5.2+) for automatic cleanup (#11701 by @alumni)
Drivers
- PostgreSQL:
ADD VALUEfor enum changes — when adding new enum values, TypeORM now uses the simplerALTER TYPE ... ADD VALUEsyntax instead of the 4-step rename-create-migrate-drop approach, when possible (#10956 by @janzipek) - PostgreSQL: additional extensions — new
installExtensionsoption to install additional PostgreSQL extensions during connection setup (#11888 by @Cprakhar) - PostgreSQL: partial index support — add support for PostgreSQL partial indices (#11318 by @freePixel)
- SAP HANA: locking in SELECT —
FOR UPDATEand other lock modes are now supported in SAP HANA queries (#11996 by @alumni) - SAP HANA: table comments —
@Entity({ comment: "..." })now works with SAP HANA (#11939 by @Cprakhar) - SAP HANA: pool timeout — new
maxWaitTimeoutIfPoolExhaustedpool option (#11868 by @alumni) - SQLite:
jsonbcolumn type — SQLite now supports thejsonbcolumn type (#11933 by @Cprakhar) - React Native: encryption key — new option to pass an encryption key for React Native SQLite databases (#11736 by @HtSpChakradharCholleti)
Persistence & Upsert
- Cascade truncate in
clear()—Repository.clear()andEntityManager.clear()now accept{ cascade: true }to issueTRUNCATE ... CASCADEon PostgreSQL, CockroachDB, and Oracle (#11866 by @Cprakhar) - Better typing for
increment/decrement— conditions parameter now uses proper entity-aware types instead ofany(#11294 by @OSA413)
Column types & Decorators
- Deferrable support on
@Exclusion— mirrors the existing deferrable support on@Uniqueand@Index(#11802 by @oGAD31)
Other
- Improved ormconfig error handling — loading failures now log warnings instead of silently failing (#11871 by @Cprakhar)
Bug fixes
Query generation
- Column alias properly escaped in
orderBy— prevents SQL errors when alias names conflict with reserved words (#12027 by @Cprakhar) addOrderByresolves database column names — using the database column name (e.g.,created_at) instead of the property name now works correctly (#11904 by @smith-xyz)- Order subquery column resolution — fixed "Cannot get metadata for given alias" error when ordering by subquery columns (#11343 by @trannhan0810)
selectcolumn ordering preserved —getQuery()/getSql()now returns columns in the order they were added viaselect()andaddSelect()(#11902 by @Cprakhar).update()query generation fixed — corrected incorrect SQL generation when using QueryBuilder.update()(#11993 by @gioboa)- Upsert SQL generation with table alias — fixed incorrect column references in upsert queries with table inheritance and custom schemas (#11915 by @Cprakhar)
- Limit with joins — fixed incorrect results when using
skip/takepagination with joins (#11987 by @gioboa) - Join attributes inside brackets — fixed join parsing when conditions contain brackets (#11218 by @balkrushna)
- Disable global
ORDER BYfor aggregate functions —repo.max(),repo.min(), etc. no longer produce invalid SQL with anORDER BYclause (#11925 by @Cprakhar) - Pagination subquery includes joined entity PKs —
leftJoinwithskip/takenow correctly loads related entities (#11669 by @mag123c) - Alias shortening with camelCase — the
shortenmethod now correctly handlescamelCase_aliases(#11283 by @OSA413)
Relations & Eager loading
- Self-referencing relation alias collision — self-referencing relations with
relationLoadStrategy: "query"no longer produce incorrect SQL due to alias collision (#11066 by @campmarc) - Eager relations no longer joined twice — explicitly specifying an eager relation in
relationsno longer causes duplicate JOINs (#11991 by @veeceey) - Save with eagerly loaded relations — fixed save failures when an entity has eagerly loaded relations (#11975 by @gioboa)
- Columns with
select: falseno longer returned — columns marked withselect: falseare now correctly excluded from query results (#11944 by @gioboa) - Subquery with
joinMapOnemethods — fixed incorrect behavior when using join map methods (#11943 by @gioboa) - Relation IDs in nested embedded entities — fixed
TypeError: Cannot set properties of undefinedwhen mapping relation IDs within embedded entities (#11942 by @Cprakhar) RelationIdLoaderalias handling — usesDriverUtils.getAliasto prevent alias trimming by databases with short identifier limits (#11228 by @te1)*-to-manyincreatePropertyPath— removed incorrect error handling that prevented certain relation configurations (#11119 by @ThbltLmr)
Persistence
- Upsert with
update: falseorgeneratedType— upsert now correctly handles columns that should not be updated (#12030 by @gioboa) - Value transformers applied to
FindOperators —ApplyValueTransformersnow correctly transforms values insideFindOperatorinstances likeIn,Between, etc. (#11172 by @ZimGil) - Soft deletion no longer updates already soft-deleted rows —
softDeleteandsoftRemovenow skip rows that are already soft-deleted (#10705 by @hassanmehdi98) - Entity merge respects
nullvalues — merging into an entity no longer silently dropsnullproperty values (#11154 by @knoid) - Map/object comparison — fixed incorrect change detection for Map and plain object column values (#10990 by @mgohin)
- Date transformer change detection — fixed false-positive dirty detection with date value transformers (#11963 by @gioboa)
- Child mpath update — tree entity mpath is now correctly updated when re-parenting, even with soft-deleted parents (#10844 by @JoseCToscano)
- Virtual property handling in schema builder — schema builder no longer attempts to create columns for virtual properties (#11000 by @skyran1278)
- Nameless
TableForeignKeydrop — dropping a foreign key without an explicit name no longer fails (#10744 by @taichunmin) getPendingMigrationsno longer creates the migrations table — checking for pending migrations no longer has side effects (#11672 by @pkuczynski)
Driver-specific fixes
- PostgreSQL:
timestamptzpersistence/hydration —timestamp with time zonecolumns now persist and hydrate correctly (#11774 by @Minishlink) - PostgreSQL: geometric type re-save — point/circle values are now normalized on persist to avoid invalid input errors when re-saving hydrated objects (#11857 by @Cprakhar)
- PostgreSQL/CockroachDB: tables with quoted names — fixed handling of tables with special characters in names (#10993 by @iskalyakin)
- PostgreSQL: sequential query execution — queries are now executed sequentially on the same connection to avoid
pg8.19.0 deprecation warnings (#12105 by @pkuczynski) - MySQL: PolarDB-X 2.0 version detection —
getVersion()no longer returnsundefinedfor PolarDB-X 2.0 (#11837 by @Missna) - MongoDB:
ObjectIdColumnproperty name translation —findOneBy({ id: value })now correctly translates to_idin MongoDB queries (#12200 by @pkuczynski) - MongoDB: embedded arrays of nested documents — correctly processes embedded arrays within nested document structures (#10940 by @mciuchitu)
- SQLite: simple-enum arrays —
simple-enumcolumns witharray: trueno longer fail with CHECK constraint errors (#11865 by @Cprakhar) - SAP HANA:
Dateparameter escaping — JSDatevalues are now passed as query parameters instead of being embedded in SQL strings (#11867 by @alumni) - CockroachDB: structured query results in txn retry — the
useStructuredResultflag is now preserved during CockroachDB transaction retry replay (#11861 by @naorpeled) - Cordova: query rows affected — query results now include the count of affected rows (#10873 by @jacobg)
Other
- CLI
initcommand — no longer crashes whenpackage.jsondoes not exist (#11947 by @gioboa) - Deno
processimport — fixed incorrect import for theprocessdependency on Deno (#11248 by @yohannpoli)
Security fixes
- SQL injection prevention — parameterized queries and escaped identifiers are now used across all drivers for schema introspection and DDL methods, preventing SQL injection via database/schema/table/column names (#12207 by @pkuczynski, #12197 by @pkuczynski, #12185 by @pkuczynski)
Performance improvements
- PostgreSQL / CockroachDB: batched DROP in
clearDatabase()— consolidates individual DROP statements into single batched queries, significantly reducing round-trips during test setup (#12164, #12159 by @pkuczynski)