Release Notes 1.0
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 Upgrading Guide for detailed upgrade instructions.
Platform requirements
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)MySQL:
QueryBuilder.useIndex()accepts index name(s), not raw SQL —useIndex()now takes either a single index name or an array of names and escapes them as identifiers. Previously the argument was interpolated as a raw, comma-separated SQL fragment, which allowed identifier injection (#12344 by @eddieran)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)
Removed APIs
.connectionproperty renamed to.dataSource— theconnectionproperty onDriver,QueryRunner,EntityManager,QueryBuilder,EntityMetadata, and all*Eventsubscriber interfaces has been renamed todataSource; a deprecated getter is provided as a bridge (#12244, #12245, #12246, #12249 by @pkuczynski)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)findOneByIdremoved — usefindOneByinstead (#12198 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()removed — it was redundant since all executed queries are already logged through the configured logger; usegetSql()orgetQueryAndParameters()to inspect SQL instead (#12151 by @naorpeled, #12220 by @pkuczynski)QueryBuilder:
WhereExpressiontype alias removed — useWhereExpressionBuilderinstead (#12097 by @pkuczynski)QueryBuilder:
replacePropertyNames()removed — it was a no-op (#12178 by @pkuczynski)joinfind option removed — userelationsfor LEFT JOINs or QueryBuilder for other join types (#12188 by @pkuczynski)String-based
selectremoved — use object syntaxselect: { id: true }instead ofselect: ["id"](#12214 by @pkuczynski)String-based
relationsremoved — use object syntaxrelations: { profile: true }instead ofrelations: ["profile"](#12215 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)RdbmsSchemaBuilder.renameTables()removed — empty no-op method that was never called (#12284 by @naorpeled)EntityMetadata.getValueMap()optionsparameter removed — theskipNullsoption was never functional; remove the third argument (#12303 by @naorpeled)
Behavioral changes
Non-nullable relations now use INNER JOIN —
ManyToOneand owningOneToOnerelations markednullable: falsenow useINNER JOINinstead ofLEFT JOIN, which may exclude rows with orphaned foreign keys (#12064 by @pkuczynski)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)ConnectionOptionsReaderandFileLoggerpaths resolved fromprocess.cwd()—ConnectionOptionsReaderno longer usesapp-root-pathto locateormconfigfiles; it searchesprocess.cwd()instead. Pass{ root: "/custom/path" }to the constructor to override.FileLogger.logPathis likewise resolved fromprocess.cwd()— use an absolute path when the app is not started from its root folder (#12257 by @alumni)
New features
Query Builder
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)
Transactions
DataSource-level default isolation level for all drivers —
DataSourceOptions.isolationLevelis now honored by every driver that supports transactions, not just SQL Server. Transactions started through the DataSource (explicitly or implicitly for DML) use this level by default (#12269 by @pkuczynski)Aurora Postgres: transaction isolation level support — Aurora Postgres now honors the
isolationLeveloption on DataSource and on explicitstartTransaction()calls (#12334 by @pkuczynski)Spanner: transaction isolation level support — Google Spanner now honors the
isolationLeveloption. Spanner'ssupportedIsolationLevelsis limited toREPEATABLE READ(currently in preview) andSERIALIZABLE(#12335 by @pkuczynski)
Drivers
PostgreSQL: partial index support — add support for PostgreSQL partial indexes (#11318 by @freePixel)
MongoDB: object-based
selectprojection —find*()methods now accept the same object-basedselectsyntax used by other drivers (select: { id: true, name: true }) in addition to the existing string-array form (#12237 by @pkuczynski)React Native: encryption key — new option to pass an encryption key for React Native SQLite databases (#11736 by @HtSpChakradharCholleti)
Persistence & Upsert
Column types & Decorators
Other
Automated codemod for v1 migration — the new
@typeorm/codemodpackage automates most breaking changes: runnpx @typeorm/codemod v1 src/to update imports, API renames, find option syntax, and more (#12233 by @pkuczynski)
Bug fixes
Query generation
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)
Join attributes inside brackets — fixed join parsing when conditions contain brackets (#11218 by @balkrushna)
JsonContainsaccepts array values —JsonContains([...])no longer throws and produces the expected@>containment predicate on PostgreSQL (#12420 by @kyungseopk1m)
Relations & Eager loading
Orphaned one-to-many children with non-nullable FK are now deleted — when saving a one-to-many relation with cascade and replacing children, orphaned rows with a non-nullable FK are now deleted instead of failing with a constraint violation; nullable FK rows are still nullified as before (#11982 by @naorpeled)
Eager relations now respect
relationLoadStrategy: "query"— eager relations are loaded via separate queries when the"query"strategy is set, instead of always using JOINs (#11326 by @SharkSharp, #12256 by @pkuczynski)Columns with
select: falseno longer returned by read queries — columns marked withselect: falseare now correctly excluded fromfindand query-builder results; useaddSelectto opt-in. Note thatselect: falseonly controls what is loaded from the database on a read — the in-memory entity returned byrepository.save()(and the reference you passed in) is left untouched, so any value you supplied is still available on it after persistence (#11944 by @gioboa, #12501 by @tada5hi)Cascade remove on
OneToManywith composite primary keys —cascade: ["remove"]now correctly propagates the delete to child entities when the target has a composite PK; previouslyCascadesSubjectBuildernever marked these children asmustBeRemoved, causing FK constraint violations (#12286 by @pkuczynski)withDeletedpropagated to relation-id loader for many-to-many recover — recovering a soft-removed entity with many-to-many relations no longer tries to re-insert existing junction rows;RelationIdLoadernow includes soft-deleted entities when the parent query haswithDeletedset (#12287 by @pkuczynski)
Persistence
Soft deletion no longer updates already soft-deleted rows —
softDeleteandsoftRemovenow skip rows that are already soft-deleted (#10705 by @hassanmehdi98)Child mpath update — tree entity mpath is now correctly updated when re-parenting, even with soft-deleted parents (#10844 by @JoseCToscano)
Closure junction table schema/database propagation — schema and database settings are now correctly propagated to closure junction tables (#12110 by @pkuczynski)
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)Many-to-many
deferrableforeign keys —@ManyToManynow honors thedeferrableoption on the junction table's foreign keys (#11924 by @smith-xyz)Composite foreign key column order — schema builder sorts referenced columns in composite foreign keys to match the referenced primary key index order, preventing MySQL / MSSQL / SAP HANA from rejecting the constraint (#12280 by @pkuczynski)
Driver-specific fixes
PostgreSQL:
timestamptzpersistence/hydration —timestamp with time zonecolumns now persist and hydrate correctly (#11774 by @Minishlink)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, including remaining relation-load and persistence paths (#12105 by @pkuczynski, #12421 by @kyungseopk1m)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)
CockroachDB: structured query results in txn retry — the
useStructuredResultflag is now preserved during CockroachDB transaction retry replay (#11861 by @naorpeled)PostgreSQL / CockroachDB: enum value declaration order — enum values are now loaded in their declared order, so generated migrations no longer churn when nothing has changed (#12404 by @pkuczynski)
Expo: auto-load
expo-sqlite— the Expo driver loadsexpo-sqlitethroughloadDependencies(), removing the need to pass the module explicitly (#12363 by @pkuczynski)
Other
CLI
initcommand — no longer crashes whenpackage.jsondoes not exist (#11947 by @gioboa); published package now correctly includesdevDependenciesneeded for scaffolding (#12281 by @pkuczynski); no longer runsnpm installduring init, so it works in offline or non-Node project setups (#12386 by @alumni)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)
OrderBy condition validation — QueryBuilder
orderByandaddOrderBynow validate condition values at runtime, preventing injection via order expressions (#12217 by @pkuczynski).limit()validated on Update/SoftDelete query builders — non-numeric values passed to.limit()now throw at call time instead of being interpolated into SQL (#12436 by @smith-xyz)
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)
Last updated