Links

CHANGELOG

​0.3.16 (2023-05-09)

Bug Fixes

Features

  • mariadb uuid inet4 inet6 column data type support (#9845) (d8a2e37)

Reverts

​0.3.15 (2023-04-15)

Bug Fixes

  • make cache optional fields optional (#9942) (159c60a)
  • prevent unique index identical to primary key (all sql dialects) (#9940) (51eecc2)
  • SelectQueryBuilder builds incorrectly escaped alias in Oracle when used on entity with composite key (#9668) (83c6c0e)

Features

​0.3.14 (2023-04-09)

Bug Fixes

  • drop xml & yml connection option support. Addresses security issues in underlying dependency (#9930) (7dac12c)

Features

​0.3.13 (2023-04-06)

Bug Fixes

  • firstCapital=true not working in camelCase() function (f1330ad)
  • handles "query" relation loading strategy for TreeRepositories (#9680) (a11809e), closes #9673​
  • improve EntityNotFound error message in QueryBuilder.findOneOrFail (#9872) (f7f6817)
  • loading tables with fk in sqlite query runner (#9875) (4997da0), closes #9266​
  • prevent foreign key support during migration batch under sqlite (#9775) (197cc05), closes #9770​
  • proper default value on generating migration when default value is a function calling [Postgres] (#9830) (bebba05)
  • react-native doesn't properly work in ESM projects because of circular dependency (#9765) (099fcd9)
  • resolve issues for mssql migration when simple-enum was changed (cb154d4), closes #7785 #9457 #7785 #9457​
  • resolves issue with mssql column recreation (#9773) (07221a3), closes #9399​
  • transform values for FindOperators #9381 (#9777) (de1228d), closes #9816​
  • use forward slashes when normalizing path (#9768) (58fc088), closes #9766​
  • use object create if entity skip constructor is set (#9831) (a868979)

Features

  • add support for json datatype for sqlite (#9744) (4ac8c00)
  • add support for STI on EntitySchema (#9834) (bc306fb), closes #9833​
  • allow type FindOptionsOrderValue for order by object property (#9895) (#9896) (0814970)
  • Broadcast identifier for removed related entities (#9913) (f530811)
  • leftJoinAndMapOne and innerJoinAndMapOne map result to entity (#9354) (947ffc3)

​0.3.12 (2023-02-07)

Bug Fixes

  • allow to pass ObjectLiteral in mongo find where condition (#9632) (4eda5df), closes #9518​
  • DataSource.setOptions doesn't properly update the database in the drivers (#9635) (a95bed7)
  • Fix grammar error in no migrations found log (#9754) (6fb2121)
  • improved FindOptionsWhere behavior with union types (#9607) (7726f5a)
  • Incorrect enum default value when table name contains dash character (#9685) (b3b0c11)
  • incorrect sorting of entities with multi-inheritances (#9406) (54ca9dd)
  • make sure "require" is defined in the environment (1a9b9fb)
  • materialized hints support for cte (#9605) (67973b4)
  • multiple select queries during db sync in sqlite (#9639) (6c928a4)
  • overriding caching settings when alwaysEnabled is true (#9731) (4df969e)
  • redundant Unique constraint on primary join column in Postgres (#9677) (b8704f8)
  • remove unnecessary .js extension in imports (#9713) (6b37e38)
  • resolve issue with "simple-enum" synchronization in SQLite (#9716) (c77c43e), closes #9715​
  • sql expression when where parameter is empty array (#9691) (7df2ccf), closes #9690​
  • synchronizing View with schema broken for oracle (#9602) (18b659d)

Features

​0.3.11 (2022-12-03)

Fixes

  • boolean parameter escape in SQLiteDriver (#9400) (4a36d0e), closes #1981​
  • cacheId not used when loading relations with take (#9469) (93e6b3d)
  • correctly return insertId for react-native (#9554) (97fae63)
  • disable transactionSupport option for CordovaDriver (#9391) (53fad8f)
  • explicitly define property for entity relation as enumerable (#9437) (85fa9c6), closes #6631​
  • fix ormUtils prototype check crashing on null prototype (#9517) (19536ed)
  • fixed outdated init command (#9422) (0984307)
  • left instead of inner join for where or + optional relations (#9516) (d490793)
  • Mark array arguments to find operators as read-only (#9474) (6eb674b)
  • pass fake flag to undoLastMigration (#9562) (2458ac7), closes #9561​
  • resolve issue with migrations and unsigned int columns in aurora-data-api (#9478) (38e0eff), closes #9477​
  • resolve nameless TableForeign on drop foreign key (#9460) (efb4168), closes #9432​
  • synchronize with typeorm_metadata table only if needed (#9175) (cdabaa3), closes #9173 #9173 #9173​
  • the mpath is incorrect when the parent of the tree entity is null (#9535) (658604d)
  • typings for Repository.extend function (#9396) (f07fb2c)

Features

​0.3.10 (2022-09-19)

Bug Fixes

  • "Cannot commit, no transaction is active" error in sql.js (#9234) (749809a), closes #9100​
  • add missing support for primaryKeyConstraintName property in EntitySchema (cc63961)
  • malformed query when selecting deeply nested embedded entities (#9273) (83f7b88)
  • prototype pollution issue (e3aac27)
  • typescript 4.8 type issues #9331 (#9357) (a1960e1)
  • Update RelationIdLoader to use DriverUtils.getAlias (#9380) (a917d65), closes #9379​

Features

  • orphanedRowAction=disabled (rebase of PR 8285) (#8678) (de15df1)
  • sqlite - deferrable options for foreign keys (#9360) (773a4fe)
  • unify Pool max connection size in supported Drivers (#9305) (48976c2), closes #3388​
  • update db image versions in docker compose (#9367) (f24b262), closes #9326​

​0.3.9 (2022-08-28)

  • fixed regression introduced in 0.3.8 - broken CLI because of #8917 (#9332), closes #9330​

​0.3.8 (2022-08-26)

Bug Fixes

  • allow space and no-space syntaxes for SQLite constraints (#9238) (bb07244), closes #9237​
  • allow where IsNull for ManyToOne relations (#9031) (72728f1), closes #8890​
  • change postgres driver version checking query (#9319) (c4f4650), closes #9318 #9318​
  • don't use temporary table name to create foreign key, unique, check constraint with SQLite (#9185) (e519910), closes #9176​
  • dropIndex now works when providing a tableIndex without name (#8937) (de8aaac)
  • entity manager remove using entity schemas (#9221) (f045536)
  • find query mongodb properly with @DeleteDateColumn() (#9262) (e49d0c8)
  • handle inherited relations insert order (#9242) (14dfadb), closes #9241​
  • handle inherited relations insert order (#9321) (3671887), closes #9242 #9241​
  • pass error to pgpool release (#9209) (eb8f0c6), closes #7792 #5112​
  • QueryBuilder update handles Date objects wrong on a ManyToOne relationship (#8748) (88d0ced), closes #8747​
  • resolve FindOptionsOrder.nulls to allow FIRST/LAST in uppercase (#8978) (5e5abbd), closes #8970​
  • resolve issues with new synonymous for GeometryCollection type in MySQL 8 (#8927) (5ebc626)
  • sqlite temporary tables now honor withoutRowid (#8431) (b8d04dc), closes #8430​
  • support async import for DataSource in CLI #8914 (#8917) (15f90e0)
  • update date utils to parse year correctly for years 1-999 (#9236) (72a0147), closes #9230​

Features

​0.3.7 (2022-06-29)

Bug Fixes

Features

  • add for_key_share ("FOR KEY SHARE") lock mode for postgres driver (#8879) (4687be8), closes #8878​
  • add nativeBinding option to better-sqlite3 driver (#9157) (bcdddc3)
  • add spanner as a db option for the init command (#9121) (e61cade)
  • allow explicitly named primary keys, foreign keys, and indices (#8900) (78df84c), closes #1355​
  • Cloud Spanner support (#8730) (62518ae)
  • fix issues with generated columns and add support in other drivers (#8806) (0418ebc), closes #8761​
  • implement support for relationids in entity schemas (#9129) (e24cced)
  • support TS 4.7+ node16/nodenext module mode (#9043) (862a402)
  • upgrade ioredis to v5 (#8997) (723f1e5)

Performance Improvements

​0.3.6 (2022-04-12)

Features

  • add for_key_share ("FOR KEY SHARE") lock mode for postgres driver (#8879) (4687be8), closes #8878​
  • new driver: Cloud Spanner (#8730) (62518ae)

​0.3.5 (2022-04-05)

Bug Fixes

  • .save repository method not returning generated uuids for aurora-postgres (#8825) (ed06f4c)
  • allow hstore type to use transformers in driver postgres (#8823) (b1a0107)
  • broken shebang parameters of cli-ts-node-commonjs and cli-ts-node-esm on some linux distros (#8821) (c5dfc11), closes #8818​
  • find select object api should support false values #8796 (#8807) (9ac8e9e)
  • resolve missing ConnectionOptions export in index.ts (#8850) (1693a17), closes #8837​
  • save correct discriminator with STI (#8819) (9d1e246), closes #2927​
  • Update DeepPartial for usage of generics with Repository class (#8817) (8ba742e)
  • fixed issue with typeorm init command (#8820)

​0.3.4 (2022-03-26)

Bug Fixes

  • BaseEntity.reload method regression and made findOne to throw error on missing conditions in runtime (#8801) (ee8c1ec)
  • improve DeepPartial recursion (#8732) (0494008), closes #8681​
  • missing timestamp in created migrations filenames (#8802) (ceee439)
  • PoolConnection leaked by MysqlDriver (#8803) (d2cfd22)
  • remove console.log calls from SelectQueryBuilder (#8795) (54c7db4), closes #8792​
  • stop crashing when redis is offline and ignoreErrors on cache options is set (#8725) (edc39d1)

Features

​0.3.3 (2022-03-23)

Bug Fixes

  • improve initialization of custom repository (#8782) (52a641c)
  • resolve entities correctly in datasource when globs are specified (#8778) (a641c5d)

Features

​0.3.2 (2022-03-22)

Bug Fixes

  • broken CLI in ESM projects since version 0.3.0 (#8773) (97699e8)

Features

  • add typeorm CLI variations that include ts-node (#8776) (05fc744)
  • allows user to specify which mysql package should be used (#8771) (35106df)

Reverts

​0.3.1 (2022-03-21)

Bug Fixes

Features

  • new array find operators (ArrayContains, ArrayContainedBy, ArrayOverlap) (#8766) (9f1b8e3):

BREAKING CHANGES

  • we do not call JSON.stringify() to json/jsonb column types in Postgres. Instead, we delegate value directly to underlying pg driver. This is a correct way of handling jsons.
  • array: true must be explicitly defined for array json/jsonb values
  • strings being JSON-stringified must be manually escaped

​0.3.0 (2022-03-17)

Changes in the version includes changes from the next branch and [email protected] version. They were pending their migration from 2018. Finally, they are in the master branch and master version.

Features

  • compilation target now is es2020. This requires Node.JS version 14+
  • TypeORM now properly works when installed within different node_modules contexts (often happen if TypeORM is a dependency of another library or TypeORM is heavily used in monorepo projects)
  • Connection was renamed to DataSource. Old Connection is still there, but now it's deprecated. It will be completely removed in next version. New API:
export const dataSource = new DataSource({
// ... options ...
})
​
// load entities, establish db connection, sync schema, etc.
await dataSource.connect()
Previously, you could use new Connection(), createConnection(), getConnectionManager().create(), etc. They all deprecated in favour of new syntax you can see above.
New way gives you more flexibility and simplicity in usage.
  • new custom repositories syntax:
export const UserRepository = myDataSource.getRepository(UserEntity).extend({
findUsersWithPhotos() {
return this.find({
relations: {
photos: true
}
})
}
})
Old ways of custom repository creation were dropped.
  • added new option on relation load strategy called relationLoadStrategy. Relation load strategy is used on entity load and determines how relations must be loaded when you query entities and their relations from the database. Used on find* methods and QueryBuilder. Value can be set to join or query.
    • join - loads relations using SQL JOIN expression
    • query - executes separate SQL queries for each relation
Default is join, but default can be set in ConnectionOptions:
createConnection({
/* ... */
relationLoadStrategy: "query"
})
Also, it can be set per-query in find* methods:
userRepository.find({
relations: {
photos: true
}
})
And QueryBuilder:
userRepository
.createQueryBuilder()
.setRelationLoadStrategy("query")
For queries returning big amount of data, we recommend to use query strategy, because it can be a more performant approach to query relations.
  • added new findOneBy, findOneByOrFail, findBy, countBy, findAndCountBy methods to BaseEntity, EntityManager and Repository:
const users = await userRepository.findBy({
name: "Michael"
})
Overall find* and count* method signatures where changed, read the "breaking changes" section for more info.
  • new select type signature in FindOptions (used in find* methods):
userRepository.find({
select: {
id: true,
firstName: true,
lastName: true,
}
})
Also, now it's possible to specify select columns of the loaded relations:
userRepository.find({
select: {
id: true,
firstName: true,
lastName: true,
photo: {
id: true,
filename: true,
album: {
id: true,
name: true,
}
}
}
})
  • new relations type signature in FindOptions (used in find* methods):
userRepository.find({
relations: {
contacts: true,
photos: true,
}
})
To load nested relations use a following signature:
userRepository.find({
relations: {
contacts: true,
photos: {
album: true,
},
}
})
  • new order type signature in FindOptions (used in find* methods):
userRepository.find({
order: {
id: "ASC"
}
})
Now supports nested order by-s:
userRepository.find({
order: {
photos: {
album: {
name: "ASC"
},
},
}
})
  • new where type signature in FindOptions (used in find* methods) now allows to build nested statements with conditional relations, for example:
userRepository.find({
where: {
photos: {
album: {
name: "profile"
}
}
}
})
Gives you users who have photos in their "profile" album.
  • FindOperator-s can be applied for relations in where statement, for example:
userRepository.find({
where: {
photos: MoreThan(10),
}
})
Gives you users with more than 10 photos.
  • boolean can be applied for relations in where statement, for example:
userRepository.find({
where: {
photos: true
}
})

BREAKING CHANGES

  • minimal Node.JS version requirement now is 14+
  • drop ormconfig support. ormconfig still works if you use deprecated methods, however we do not recommend using it anymore, because it's support will be completely dropped in 0.4.0. If you want to have your connection options defined in a separate file, you can still do it like this:
import ormconfig from "./ormconfig.json"
​
const MyDataSource = new DataSource(require("./ormconfig.json"))
Or even more type-safe approach with resolveJsonModule in tsconfig.json enabled:
import ormconfig from "./ormconfig.json"
​
const MyDataSource = new DataSource(ormconfig)
But we do not recommend use this practice, because from 0.4.0 you'll only be able to specify entities / subscribers / migrations using direct references to entity classes / schemas (see "deprecations" section).
We won't be supporting all ormconfig extensions (e.g. json, js, ts, yaml, xml, env).
  • support for previously deprecated migrations:* commands was removed. Use migration:* commands instead.
  • all commands were re-worked. Please refer to new CLI documentation.
  • cli option from BaseConnectionOptions (now BaseDataSourceOptions options) was removed (since CLI commands were re-worked).
  • now migrations are running before schema synchronization if you have both pending migrations and schema synchronization pending (it works if you have both migrationsRun and synchronize enabled in connection options).
  • aurora-data-api driver now is called aurora-mysql
  • aurora-data-api-pg driver now is called aurora-postgres
  • EntityManager.connection is now EntityManager.dataSource